Closed enrico-lattuada closed 5 months ago
Possibly connected to this.
The problem must be treated slightly differently for the different OSs.
The common part is using the MODULE
option in the pybind11_add_module
CMake function.
Linux automatically links the Python libraries when using the MODULE
option. We don't need to make any changes.
We must not explicitly link Python
in the lower level libraries. We trust -undefined dynamic_lookup
.
Add the following property for fddm
(and for fddm_cuda
as well, even though this should not be necessary since CUDA is not supported on macOS)
if(APPLE)
set_target_properties(fddm PROPERTIES
LINK_FLAGS "-undefined dynamic_lookup"
)
endif(APPLE)
For Windows, we must explicitly link Python
(at least, I found no source saying otherwise).
Add the following lines for both fddm
and fddm_cuda
if(WIN32)
target_link_libraries(fddm PUBLIC ${PYTHON_LIBRARIES})
endif(WIN32)
Also, since after pybind11_add_module
the two options SHARED
and MODULE
are treated differently on Windows, we need to change the core
and core_cuda
target property from RUNTIME_OUTPUT_DIRECTORY_RELEASE
to LIBRARY_OUTPUT_DIRECTORY_RELEASE
.
Closed by #207
Description When using the package built with C++ enabled inside a conda environment on MacOS, I get a segmentation fault error when I import the library from Python.
To Reproduce Steps to reproduce the behavior:
fastddm-test.yml
.ENABLE_CPP=ON
Expected behavior Import without errors.
Desktop (please complete the following information):
Additional context This might also be connected to the same problem (with or sometimes without conda environments) on other systems with multiple Python and C++ compiler versions installed.