I have to use a debug version of a shared library (in particular libpcap installed in Ubuntu via apt-get install libpcap0.8-dbg)…i build my executable and link against it and all works (verified with ldd)…but when i run the executable i get a segfault…the dynamic linker can’t load the library. Using objdump i see that Dynamic section is empty:
$objdump -p libpcap.so.1.1.1
...
Dynamic section:
$
I think that in ELF shared objects some fields of Dynamic section are mandatory…so, why this section is empty? Maybe there is a different method for loading it correctly?
To be honest I don’t use Ubuntu, but AFAIK debug packages do not contain full versions of libraries or binaries, just stripped debugging informations from them. These are just sections cut out by eu-strip or similar tool. You should not link against them. As matter of fact, there’s no need to relink your app at all. You should just instruct gdb, valgrind or other debugging information consumer to read them before actual debugging if the tools are not able to do that by themselves, that’s all.