I asked another question that was too complicated for a direct answer, so I dropped it to this basic question ...
When I create my aModule.so using the standard cython distribution, it doesn't seem to be related to libpython :
$ otool -L aModule.so aModule.so: /usr/local/lib/libboost_thread-mt.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/local/opt/thrift/lib/libthrift-0.9.0.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
But when I build with the cmake setting, it continues to create a linker command that links libpython to .so:
$ otool -L aModule.so aModule.so: /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.1) /usr/local/opt/thrift/lib/libthrift-0.9.0.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/local/lib/libboost_thread-mt.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
The module created by distutils seems to work just fine with any of my python2.7 installation (system or virtual file for my project). While cmake crashes with version mismatch when I try to import it using anything other than the associated system python.
Why does the distutils module work fine without being contacted? And if that is the case, why do I need cmake build to link libpython, and how could I prevent it, if so, so that it works with any of my python2.7 interpreters without crashing?
Currently I can direct cmake to the right python with: CXX=g++ cmake -DPYTHON_LIBRARY=/path/to/another/Python
source share