首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何修复/usr/bin/ld:找不到-lboost_python

如何修复/usr/bin/ld:找不到-lboost_python
EN

Stack Overflow用户
提问于 2019-04-09 01:05:41
回答 1查看 1.6K关注 0票数 1

我只是按照https://www.boost.org/doc/libs/1_69_0/libs/python/doc/html/building/no_install_quickstart.html上的说明安装了boost.python,但是当我尝试运行代码时

代码语言:javascript
复制
    bjam toolset=gcc --verbose-test test 

它抛出:

代码语言:javascript
复制
...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。谢谢

EN

回答 1

Stack Overflow用户

发布于 2019-11-14 20:56:13

这是一个链接器错误。可能lib文件使用了不同的名称,因此必须手动创建符号链接。

在usr/lib目录中搜索并找到"libboost_pythonXX.so“文件

XX将与您在构建时配置boost时使用的python版本相匹配,因为抛出的异常可能是使用python2.7配置的,因此该文件可能会被命名为libboost_python27.so

然后创建一个符号链接:

sudo ln -s "libboost_pythonXX.so“libboost_python.so

您可以使用此链接作为参考。

https://github.com/BVLC/caffe/issues/4843

它帮助我解决了这个错误。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55578394

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档