问题描述
我建立一个升压Python模块(的.so共享库文件),它依赖于其他外部库(STXXL)
I am building a Boost Python module (.so shared library file) which depends on another external library (STXXL)
虽然我可以建立并导入例如升压Python模块,我遇到问题时STXXL被扔进组合。具体运行时,进口fast_parts
在python
While I can build and import the example Boost Python modules, I run into problems when STXXL is thrown into the mix. Specifically when running import fast_parts
in python
我得到导入错误:./fast_parts.so:未定义的符号:_ZN5stxxl10ran32StateE
这对我说了STXXL库没有被联系在一起,但我不知道如何,可能是因为我对连接它和链接器不会给我任何错误。值得注意的是,我可以成功打造并使用STXXL独立运行的程序,并就我知道的库存储在如下所示lib目录中以.a存档。我已经减少了我的Makefile到一个单一的命令如下:
This says to me that the STXXL library isn't being linked, but I am not sure how that could be as I am linking against it and the linker isn't giving me any errors. It's worth noting I can successfully build and run standalone programs using STXXL and as far as I know the libraries are stored in a .a archive in the lib directory shown below. I have reduced my Makefile down to a single command as follows:
G ++ -I /家庭/泽纳/下载/ stxxl-1.3.0 /包括-include stxxl /位/ defines.h -I /家庭/泽纳/本地/包括-I在/ usr /包括/ python2.6的-D_FILE_OFFSET_BITS = 64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -O3 -Wall -g -DFOO = BAR -pthread -L /家庭/泽纳/下载/ stxxl-1.3.0 / lib中/ -lstxxl -L /家庭/泽纳/ local / lib目录/ -lboost_python -lpython2.6 -fPIC -shared -o fast_parts.so partition.cpp
任何意见?
推荐答案
我假设Linux的,请评论,如果这是不正确。什么是用于 libfast_parts.so
的 LDD
输出是什么样子?这是否说明 libstxxl.so
找不到?
I'm assuming Linux, please comment if this is incorrect. What does the ldd
output for libfast_parts.so
look like? Does it indicate libstxxl.so
is not found?
您可能需要添加 /home/zenna/Downloads/stxxl-1.3.0/lib /
在 LD_LIBRARY_PATH
或rpath的为 libfast_parts.so
。
You might need to add /home/zenna/Downloads/stxxl-1.3.0/lib/
in your LD_LIBRARY_PATH
or the rpath for libfast_parts.so
.
-Wl,-rpath,/home/zenna/Downloads/stxxl-1.3.0/lib -L/home/zenna/Downloads/stxxl-1.3.0/lib -lstxxl
这篇关于链接静态库进入Boost的Python(共享库) - 导入错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!