ELF:链接:为什么我在.so文件中获得未定义的引用 [英] ELF: linking: Why do I get undefined references in .so files
问题描述
我正在尝试针对wxWidgets构建程序,但出现链接器错误.我想真正理解它的意思.错误是:
I'm trying to build a program against wxWidgets, and I get a linker error. I'd like to really understand what it means. The error is:
/usr/lib/libwx_baseu-2.8.so: undefined reference to `std::ctype<char>::_M_widen_init() const@GLIBCXX_3.4.11'
我不明白的是为什么错误出现在libwx_baseu-2.8.so
上.我认为.so
文件的所有符号都已解析,与.o
文件仍然需要链接相反.
What I don't understand is why the error is at libwx_baseu-2.8.so
. I thought that .so
files had all its symbols resolved, contrary to .o
files that still need linking.
当我ldd
.so
时,我可以解析其所有链接的库,因此那里没有问题:
When I ldd
the .so
, I get can resolve all its linked libraries, so there is no problem there:
$ ldd /usr/lib/libwx_baseu-2.8.so
linux-gate.so.1 => (0x00476000)
libz.so.1 => /lib/libz.so.1 (0x00d9c000)
libdl.so.2 => /lib/libdl.so.2 (0x002a8000)
libm.so.6 => /lib/libm.so.6 (0x00759000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x002ad000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0068d000)
libpthread.so.0 => /lib/libpthread.so.0 (0x006f0000)
libc.so.6 => /lib/libc.so.6 (0x00477000)
/lib/ld-linux.so.2 (0x007f6000)
这是否意味着.so
文件未正确编译(在这种情况下,这是我的分发程序包中的错误),还是意味着我的特定程序的链接器命令行上缺少库?
Does it means that the .so
file was not compiled correctly (in that case, it's a bug in my distribution package) or does it means that there are missing libraries on the linker command line for my particular program?
此外,您知道我如何获得ELF文件中未定义符号的列表.我尝试了readelf -s
,但是找不到丢失的符号.
Additionally, do you know how I can get a list on undefined symbols in an ELF file. I tried readelf -s
but I can't find the missing symbol.
谢谢.
Mildred
推荐答案
I thought that .so files had all its symbols resolved, contrary to .o files that still need linking.
共享库可能不完整,可以.
Shared libraries can be incomplete, that is OK.
do you know how I can get a list on undefined symbols in an ELF file
使用
nm -C -u libwx_baseu-2.8.so
这篇关于ELF:链接:为什么我在.so文件中获得未定义的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!