简体   繁体   English

符号查找错误未定义符号,但似乎所有符号都存在

[英]Symbol lookup error undefined symbol, but all symbols seem to be present

An executable seemingly can't resolve a symbol in a linked library. 可执行文件似乎无法解析链接库中的符号。 The relevant output of LD_DEBUG=libs shows that the correct library is loaded: 6557: /usr/lib/libcharon.so.0: error: symbol lookup error: undefined symbol: auth_class_names (fatal) /usr/libexec/ipsec/charon: symbol lookup error: /usr/lib/libcharon.so.0: undefined symbol: auth_class_names LD_DEBUG = libs的相关输出表明已加载正确的库: 6557: /usr/lib/libcharon.so.0: error: symbol lookup error: undefined symbol: auth_class_names (fatal) /usr/libexec/ipsec/charon: symbol lookup error: /usr/lib/libcharon.so.0: undefined symbol: auth_class_names

nm -D shows that the symbol auth_class_names is defined: nm -D显示定义了符号auth_class_names:

nm -D /usr/lib/libcharon.so.0|grep auth_class_names U auth_class_names

All clues and ideas welcome 欢迎所有线索和想法

EDIT: Outputs of ldd added: 编辑:添加的ldd输出:

/usr/lib# ldd /usr/lib/libstrongswan.so
    libpthread.so.0 => /lib/arm-linux-gnueabi/libpthread.so.0 (0xb6ecd000)
    libdl.so.2 => /lib/arm-linux-gnueabi/libdl.so.2 (0xb6ec2000)
    librt.so.1 => /lib/arm-linux-gnueabi/librt.so.1 (0xb6eb3000)
    libc.so.6 => /lib/arm-linux-gnueabi/libc.so.6 (0xb6d78000)
    /lib/ld-linux.so.3 (0xb6f25000)
/usr/lib# ldd /usr/lib/libcharon.so
    libm.so.6 => /lib/arm-linux-gnueabi/libm.so.6 (0xb6ea6000)
    libpthread.so.0 => /lib/arm-linux-gnueabi/libpthread.so.0 (0xb6e86000)
    libdl.so.2 => /lib/arm-linux-gnueabi/libdl.so.2 (0xb6e7b000)
    libcap.so.2 => /lib/arm-linux-gnueabi/libcap.so.2 (0xb6e70000)
    libc.so.6 => /lib/arm-linux-gnueabi/libc.so.6 (0xb6d35000)
    /lib/ld-linux.so.3 (0xb6fa6000)
    libattr.so.1 => /lib/arm-linux-gnueabi/libattr.so.1 (0xb6d27000)

# nm -D /usr/lib/libstrongswan.so|grep auth_class
00036a50 D auth_class_names

nm -D shows that the symbol auth_class_names is defined nm -D显示定义了符号auth_class_names

No: it shows that auth_class_names is un defined in libcharon.so . 无:它表明auth_class_names在规定libcharon.so

libstrongswan provides the auth_class symbol, but libcharon doesn't reference it. libstrongswan提供auth_class符号,但libcharon不引用它。

Wrong again: libcharon.so does reference the symbol. 再次错误: libcharon.so 确实引用了该符号。

ldd /usr/lib/libstrongswan.so

That's not what you want. 不是你想要的。 You want ldd /usr/lib/libcharon.so . 您需要ldd /usr/lib/libcharon.so

Your problem is most likely that neigher libcharon.so , nor the main executable were linked against libstrongswan.so , so when you dynamically load libcharon.so , libstrongswan.so is nowhere to be found; 您的问题很可能是libcharon.so或主可执行文件libstrongswan.so链接到libstrongswan.so ,因此,当您动态加载libcharon.solibstrongswan.so hence the loading fails with undefined symbol. 因此,加载失败并带有未定义的符号。

There are several possible solutions, ordered from more correct to more hacky: 有几种可能的解决方案,从更正确到更棘手:

  1. Link libcharon.so against libstrongswan.so . libcharon.solibstrongswan.so链接。 Loading libcharon.so will load all of its dependencies (which will now include libstrongswan.so , and the symbol will be found). 加载libcharon.so将加载其所有依赖项(现在将包括libstrongswan.so ,并将找到该符号)。

  2. Link charon binary against libstrongswan.so . 链接charon对二进制libstrongswan.so

  3. Dynamically load libstrongswan.so before you load libcharon.so . 在加载libstrongswan.so 之前动态加载libcharon.so
  4. LD_PRELOAD=libstrongswan.so

Actually "U" means, that symbol is undefined. 实际上,“ U”表示该符号未定义。 What does ldd show on your libcharon.so.0 ? ldd在您的libcharon.so.0上显示什么? libstrongswan.so.0 is where you should find auth_class_names . libstrongswan.so.0是您应该在其中找到auth_class_names

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 imp:符号查找错误:未定义符号sldext - imp : symbol lookup error : undefined symbol sldext 符号查找错误:未定义的符号:_alloca - symbol lookup error: undefined symbol: _alloca 符号查找错误未定义符号:mysql_init - Symbol lookup error undefined symbol: mysql_init 符号查找错误:未定义符号:FT_Get_Font_Format - symbol lookup error: undefined symbol: FT_Get_Font_Format 如何修复符号查找错误:群集环境中的未定义符号错误 - How to fix symbol lookup error: undefined symbol errors in a cluster environment 系统查找错误未定义符号SFML - system lookup error undefined symbol SFML 符号查找错误:未定义的符号 atexit (linux/C) - Symbol lookup error: undefined symbol atexit (linux/C) 未定义的符号引用 '<symbol> '...添加符号时出错:命令行中缺少 DSO(使用 CMake)</symbol> - Undefined Reference to Symbol '<Symbol>' ... Error Adding Symbols: DSO Missing From Command Line (With CMake) 无法安装 gobject-introspection - 符号查找错误:和未定义的符号:g_unicode_type_get_type - Unable to install gobject-introspection - symbol lookup error: and undefined symbol: g_unicode_type_get_type 符号查找错误:/usr/local/lib/libsvn_subr-1.so.0:未定义的符号:apr_atomic_xchgptr - symbol lookup error: /usr/local/lib/libsvn_subr-1.so.0: undefined symbol: apr_atomic_xchgptr
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM