How to check whether a library is Debug or Release in Linux
I WANT TO CHECK IF THE COMPILED LIBRARY IS DEBUG MODE OR RELEASE MODE.
objdump --syms, but it doesn’t seem to work. I’ve tried objdump –syms *.a | grep
debugging objdump --syms *.a | grep
release. But neither prints.
How do I see the compiled type of a library in Linux?
Strictly speaking, libraries in Linux do not have such a concept as “debug” or “release” mode.
gcc can generate libraries with or without debug symbols that can later be used by
the gdb debugger, with or without optimizations. Debug symbol output is controlled by the option –
g passed to gcc when any unit is compiled, and optimizations are controlled by flags -O1, –
O2, and -O3 for different levels of optimization.
Suppose you want to know if the library contains debug symbols, and you have run the correct command for it:
objdump --syms *.a | grep debug Usually produces non-empty output for objects that contain debug symbols. Filtering the output by the word “publish” does not give you any information about how the library was compiled, because there is no term “publish”.
Also note that many open source libraries are distributed compiled with debug notation and optimizations enabled, so there is some mix of what is considered “debugging” and “publishing”.