[英]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.so
, libstrongswan.so
; hence the loading fails with undefined symbol. 因此,加载失败并带有未定义的符号。
There are several possible solutions, ordered from more correct to more hacky: 有几种可能的解决方案,从更正确到更棘手:
Link libcharon.so
against libstrongswan.so
. 将libcharon.so
与libstrongswan.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
,并将找到该符号)。
Link charon
binary against libstrongswan.so
. 链接charon
对二进制libstrongswan.so
。
libstrongswan.so
before you load libcharon.so
. 在加载libstrongswan.so
之前动态加载libcharon.so
。 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.