Linux GCC: debug libraries and building adjusted GCC configuration
Posted on 2011-03-12
I'm new in Linux development, starting C++ development for CentOS 5.5 in C++. I'm a WIndows programmer and used to C++ development in Visual Studio. So, I have some Linux-specific related questions and would appreciate any assistance. Time to time I'm going to post some questions.
I got Centos 5.5 in a VmWare image. So, GCC was configured by somebody, maybe in the default way. I need to adjust or rebuild it for my needs.
It seems GCC was installed via rpm packages:
rpm -qa | grep gcc
Here is my GCC configuration:
version 4.1.2 20080704 (Red Hat 4.1.2-48)
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-126.96.36.199/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
1. The first thing I faced with: there aren't any debug libraries (*.a, *.so) for default libraries.
I build a hello world application as:
COMPILE=g++ -c "-D_GLIBCXX_DEBUG" -g -O0 -fno-inline -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -g -o "$(OUTFILE)" $(ALL_OBJ)
ldd shows these dependences:
linux-gate.so.1 => (0x00fd7000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x02839000)
libm.so.6 => /lib/libm.so.6 (0x00c54000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x02702000)
libc.so.6 => /lib/libc.so.6 (0x00ad9000)
All the libs are release. So, I can't step into them in the debugger.
Q1.: How to add debug default libraries and their sources to GCC installation?
Q2.: How to link properly my application in DEBUG configuration to debug libraries? In Visual Studio in debug conf. an application is linked to debug versions of std. libraries suffixed by "d". What's approach is used in Linix GCC?
Q3. What could you say about my GCC configuration shown above? Definitely, I would rebuild GCC with C, C++ turned on languages only. Any other advises about the configuration? I need c/c++, x86 32/64 bit, with debug std libs configuration.
Also, where could I find a step by step instruction how to build and install GCC configuration I need?
With best regards,