Installing the GNU Debugger
The GNU Debugger (GDB) is the standard debugger for the GNU software system. It is a portable debugger that runs on many Unix-like systems and works for many programming languages, including Ada, C, C++, FreeBASIC, FreePascal and Fortran.
Installation is trivial, but slightly interesting for illustrative purposes. First download and unpack:
cd /usr/local/src/GDB
wget ftp://ftp.gnu.org/gnu/gdb/gdb-7.3.tar.gz
tar xvf gdb-7.3.tar.gz
cd gdb-7.3
Use a set of typical autoconf commands to install. The README recommends that if you have more than one compiler on your system (and who doesn't?) that it is advantageous explicitly set it becore running configure and make.
CC=gcc ./configure --prefix=/usr/local/$(basename $(pwd) | sed 's#-#/#')
make
make install
Assuming you're using environment modules (and why not?), create a new module.
e.g.,
cd /usr/local/Modules/modulefiles/gdb
ln -s .base 7.3
The .base file simply takes the form:
#%Module1.0#####################################################################
## $name modulefile
set ver [lrange [split [ module-info name ] / ] 1 1 ]
set name [lrange [split [ module-info name ] / ] 0 0 ]
set loading [module-info mode load]
set desc [join [read [ open "/usr/local/Modules/modulefiles/$name/.desc" ] ] ]
proc ModulesHelp { } {
puts stderr "\tThis module sets the envinronment for $name v$ver"
}
module-whatis "$desc (v$ver)"
prepend-path LD_LIBRARY_PATH /usr/local/$name/$ver/lib
prepend-path LD_LIBRARY_PATH /usr/local/$name/$ver/lib64
prepend-path MANPATH /usr/local/$name/$ver/man
prepend-path PATH /usr/local/$name/$ver/bin
Login as a normal user run a minimal test on an executable compiled with any of the above. There is very good documentation on how to do this.