How can I tell if a library was compiled with -g?

If you’re running on Linux, use objdump --debugging. There should be an entry for each object file in the library. For object files without debugging symbols, you’ll see something like:

objdump --debugging libvoidincr.a
In archive libvoidincr.a:

voidincr.o:     file format elf64-x86-64

If there are debugging symbols, the output will be much more verbose.

Leave a Comment