【问题标题】:Undefined symbol error: the target library has been set in rpath but it still cannot be found未定义符号错误:目标库已在 rpath 中设置但仍找不到
【发布时间】:2018-05-01 15:58:35
【问题描述】:
calving@norfolk:~/sandbox/stage/third_party/houdini16.5/lib$ ldd libgusd.so | grep boost
    libboost_python.so.1.55.0 => /home/calveng/sandbox/stage/third_party/houdini16.5/lib/./../../../lib/libboost_python.so.1.55.0 (0x00007f735cb9c000)
    libboost_regex.so.1.55.0 => /home/calveng/sandbox/stage/third_party/houdini16.5/lib/./../../../lib/./libboost_regex.so.1.55.0 (0x00007f735af6a000)
calving@norfolk:~/sandbox/stage/third_party/houdini16.5/lib$ readelf -s --wide libgusd.so | grep _ZN5boost6system16generic_categoryEv
    1064: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ZN5boost6system16generic_categoryEv
    6632: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ZN5boost6system16generic_categoryEv

一旦我尝试链接这个“libgusd.so”库,它会抛出一个错误:“undefined symbol: _ZN5boost6system16generic_categoryEv”

但是重点是包含boost的路径已经被嵌入的rpath设置好了,其他的boost文件可以正常链接。

以前有没有人遇到过类似的情况?任何提示都会很有帮助。

提示:我的环境中没有 LD_LIBRARY_PATH,因此不会被覆盖。

【问题讨论】:

    标签: boost linker shared-libraries linker-errors dynamic-linking


    【解决方案1】:

    好吧,它通过以下方式解决:

    patchelf --add-needed libboost_system.so.1.55.0 libgusd.so

    我想我对链接库和它们的路径之间的区别仍然有点困惑......我认为所有的动态库都会在程序需要它们时自动链接。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-05
      • 2021-11-29
      • 1970-01-01
      • 2013-04-01
      • 2017-08-04
      • 2012-05-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多