-
Hello, I am trying to use ipopt and Open3D together in the same C++ project (Open3D is a 3D data processing library). Everything worked fine when I ran ipopt or Open3D independently. But after I linked the two together, I got segment fault. Once I remove Open3D from target_link_libraries in CMake file, segment fault disappeared. My CMake file is like this: cmake_minimum_required(VERSION 3.26)
project(link_test)
set(CMAKE_CXX_STANDARD 17)
find_package(Open3D REQUIRED)
add_executable(link_test main.cpp myTNLP.cpp myTNLP.h)
target_link_libraries(link_test PRIVATE ipopt Open3D::Open3D) # Segment fault occurs
# target_link_libraries(link_test PRIVATE ipopt) # Segment fault disappears
The test code I used in main.cpp, myTNLP.cpp and myTNLP.h is the same as /examples/Cpp_example. Open3D is only linked but never used in the test code. And here is the debug info when segment fault occurs (IpBlas.cpp:252): I have no ideal about what causes this problem nor how to fix this, could anyone help me with this please? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Since the error comes up in MKL, I would guess that by linking to Open3D, you like to an incompatible MKL library. For example, Ipopt may expect a Blas library that uses 32bit integers, while the MKL library used here uses 64bit integers. (Such mismatch sometimes come up when using Ipopt from Matlab.) Looking at the actual linker commands may give some more information. Maybe using a static version of Blas+Lapack/MKL when building Ipopt could help. |
Beta Was this translation helpful? Give feedback.
Since the error comes up in MKL, I would guess that by linking to Open3D, you like to an incompatible MKL library. For example, Ipopt may expect a Blas library that uses 32bit integers, while the MKL library used here uses 64bit integers. (Such mismatch sometimes come up when using Ipopt from Matlab.)
Looking at the actual linker commands may give some more information. Maybe using a static version of Blas+Lapack/MKL when building Ipopt could help.