我的问题包括我的python脚本中的共享对象文件,运行ubuntu 16.04。这个脚本的文件提供给我,我没有可能重新编译它们。它是一个使用旧的boost库(1.34.1)线程和序列化的文件。我得到的错误是:
ImportError: ./libsubs_reg.so: undefined symbol: _ZN5boost21recursive_timed_mutexC1Ev
检查libsus_reg的依赖库:
# readelf -d libsubs_reg.so
Dynamic section at offset 0x27118 contains 28 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libboost_serialization-gcc42-mt-1_34_1.so.1.34.1]
0x00000001 (NEEDED) Shared library: [libboost_thread-gcc42-mt-1_34_1.so.1.34.1]
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
0x00000001 (NEEDED) Shared library: [libm.so.6]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.6]
我创建了从1.34.1 boost版本到当前安装的1.58.0。
的链接# ldd libsub_reg.so
linux-gate.so.1 => (0xb7762000)
libboost_serialization-gcc42-mt-1_34_1.so.1.34.1 => /usr/lib/i386-linux-gnu/libboost_serialization-gcc42-mt-1_34_1.so.1.34.1 (0xb76ba000)
libboost_thread-gcc42-mt-1_34_1.so.1.34.1 => /usr/lib/i386-linux-gnu/libboost_thread-gcc42-mt-1_34_1.so.1.34.1 (0xb7695000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb751d000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb74c8000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb74ab000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb72f5000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb72d8000)
libboost_system.so.1.58.0 => /usr/lib/i386-linux-gnu/libboost_system.so.1.58.0 (0xb72d2000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb72c9000)
/lib/ld-linux.so.2 (0x80027000)
检查链接......
# ls -la libboost* | grep "\->"
lrwxrwxrwx 1 root root 24 jun 14 2016 libboost_regex.so -> libboost_regex.so.1.58.0
lrwxrwxrwx 1 root root 32 nov 8 14:53 libboost_serialization-gcc42-mt-1_34_1.so.1.34.1 -> libboost_serialization.so.1.58.0
lrwxrwxrwx 1 root root 32 jun 14 2016 libboost_serialization.so -> libboost_serialization.so.1.58.0
lrwxrwxrwx 1 root root 26 jun 14 2016 libboost_signals.so -> libboost_signals.so.1.58.0
lrwxrwxrwx 1 root root 25 jun 14 2016 libboost_system.so -> libboost_system.so.1.58.0
lrwxrwxrwx 1 root root 25 nov 8 14:54 libboost_thread-gcc42-mt-1_34_1.so.1.34.1 -> libboost_thread.so.1.58.0
lrwxrwxrwx 1 root root 25 jun 14 2016 libboost_thread.so -> libboost_thread.so.1.58.0
检查其他类似的问题,如果我已经正确理解,“未定义的符号”将意味着无法找到包含recursive_timed_mutex的boost lib(thread),但我看不出我的链接错误。我可以承认,我在这个方面已经超出了我的范围,但我真的需要让它发挥作用。任何帮助将不胜感激。