Closed coreyjadams closed 2 years ago
Conda doesn't support building from python, only from Conda-build. You are likely mixing the system compilers and the conda compilers, causing the crash. Try conda install compilers
- that might get it to use the conda compilers (make sure you remove any caching, like _skbuild
).
I do see this issue as well on macOS x64 -- but I am pretty sure I am using the conda compilers :)
I tried to add -undefined dynamic_lookup
which helped in the past, and I tried to remove the CMAKE_STRIP
step, but none of that helped so far. Will investigate further.
It's failing for us for rclpy
which is a dependency of ROS
, the robot operating system. Same exact error.
Hm, I managed to replicate the issue with your example larcv
code.
The problem seems to boil down to not explicitly link Python
in the lower level libraries (or anywhere) and to trust "-undefined dynamic_lookup"
.
I've added
set_target_properties(larcv3 PROPERTIES
LINK_FLAGS "-undefined dynamic_lookup")
and removed any instances of linking to ${Python_LIBRARIES}
and things then seem to work. I think the pybind11_add_module
automatically sets that linker flag already.
@wolfv thanks for this tip! I will test it out tomorrow and get back to you, that'd be awesome to have this resolved.
In my case, pybind11_add_module(blabla SHARED ...)
did not work, however pybind11_add_module(blabla MODULE ...)
works.
Required prerequisites
Problem description
I have a segmentation fault on macos that only appears using the conda builds of python. I haven't been able to solve this one myself, sorry.
In short: When using the package I've built with pybind11, I can not import the libraries from python without a segfault. I've verified this with python 3.6, 3.9, 3.10, and using the latest version of pybind11. I have a stand-alone repository that reproduces this bug.
Here is the stack track when running with
lldb
, it appears to be related totake_gil
Reproducible example code
From a different directory (otherwise, it tries to import the
larcv
folder in the repo), do:And it ought to reproduce the crash.