compiling glibc from source with debug symbols

时间秒杀一切 提交于 2021-02-19 02:27:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!