我刚刚按照https://www.boost.org/doc/libs/1_69_0/libs/python/doc/html/building/no_install_quickstart.html上的说明安装了boost.python但是当我尝试运行代码
bjam toolset=gcc --verbose-test test
它抛出:
...found 23 targets...
...updating 6 targets...
gcc.link.dll extending.so
/usr/bin/ld: cannot find -lboost_python
collect2: error: ld returned 1 exit status
"g++" -o "extending.so" -Wl,-h -Wl,extending.so -shared -Wl,--start-group "extending.o" -Wl,-Bstatic -Wl,-Bdynamic -lboost_python -ldl -lpthread -lutil -Wl,--end-group -fPIC -g
...failed gcc.link.dll extending.so...
...skipped <p.>test_ext for lack of <p.>extending.so...
gcc.link test_embed
/usr/bin/ld: cannot find -lboost_python
collect2: error: ld returned 1 exit status
"g++" -L"/usr/lib" -L"/usr/lib/python2.7/config" -Wl,-rpath -Wl,"/usr/lib" -Wl,-rpath -Wl,"/usr/lib/python2.7/config" -o "test_embed" -Wl,--start-group "embedding.o" -Wl,-Bstatic -Wl,-Bdynamic -lboost_python -ldl -lpthread -lutil -lpython2.7 -Wl,--end-group -fPIC -g
...failed gcc.link test_embed...
...skipped <p.>test_embed.run for lack of <p.>test_embed...
...failed updating 2 targets...
...skipped 4 targets...
有人知道如何解决吗?我只希望boost使用boost.python。谢谢
这是链接器错误。 lib文件的名称可能不同,因此必须手动创建符号链接。您可以使用此链接进行参考。
https://github.com/BVLC/caffe/issues/4843
它帮助我为我解决了错误。