问题
I need to compile glibc from source with debug symbols .
1.Where do i specify the '-g' option for this
2.How do i later make a sample code link to this particular glibc rather than the one installed on my system?
回答1:
I need to compile glibc from source with debug symbols
You will have hard time compiling glibc without debug symbols. A default ./configure && make
will have -g
on compile line.
How do i later make a sample code link to this particular glibc rather than the one installed on my system?
This is somewhat tricky, and answered here.
回答2:
It is probably a matter of configure
tricks. First, try configure --help
and then, either configure --enable-debug
or perhaps configure CC='gcc -g'
or even configure CFLAGS='-g'
For your sample code, perhaps consider playing LD_LIBRARY_PATH
or LD_PRELOAD
tricks (assuming linking to dynamic library).
But be very careful, since the Glibc is the cornerstone of Gnu/Linux like systems.
来源:https://stackoverflow.com/questions/10138342/compiling-glibc-from-source-with-debug-symbols