ELF: linking: Why do I get undefined references in .so files

Posted by ki.lya.online.fr on Stack Overflow See other posts from Stack Overflow or by ki.lya.online.fr
Published on 2010-04-15T08:26:50Z Indexed on 2010/04/15 8:43 UTC
Read the original article Hit count: 530

Filed under:
|
|
|
|

Hi,

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'

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.

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)

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?

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.

Thank you.

Mildred

© Stack Overflow or respective owner

Related posts about c++

Related posts about linker