我试图构建一个python包,它依赖于几个库,包括boost、boostpython和fftw。我可以编译包而没有任何错误,但是当我试图用steme --help命令运行程序时,我得到了一个错误:2016-08-11 15:07:55,571:ERROR: ImportError: dlopen(/Users/<>/.ENV/lib/python2.7/site-packages/STEME-1.9.1-py2.7-macosx-10.11-intel.egg/stempy/_release_build/_index.so, 2): Symbol not found: __ZN5boost6python6detail13current_scopeE
Referenced from: /Users/<>/.ENV/lib/python2.7/site-packages/STEME-1.9.1-py2.7-macosx-10.11-intel.egg/stempy/_release_build/_index.so
Expected in: flat namespace
in /Users/<>/.ENV/lib/python2.7/site-packages/STEME-1.9.1-py2.7-macosx-10.11-intel.egg/stempy/_release_build/_index.so
我的理解是文件_index.so正在寻找符号__ZN5boost6python6detail13current_scopeE,但找不到它。接下来,我使用otool -L检查了哪些库链接到_index.so文件:
^{pr2}$
基于此,我认为正在发生的是,boost-python动态库在编译期间没有正确链接到_index.so。为了检查我是否在boost-pythondylib上运行了nm -g(这些dylib是使用brew安装的,以及其他提到的依赖项)。在libboost_python.dylib文件中找到缺少的符号:
0000000000031d08 S __ZN5boost6python6detail13current_scopeE
所以,我的下一个问题是,如何将libboost_python.dylib文件(位于/usr/local/Cellar/boost-python/1.61.0/lib)链接到_index.so文件?这样能解决问题吗?是否需要设置一些编译器标志以确保构建正确链接?在