Building GDB Natively

Ever since the GDB and the binutils repositories were integrated (due to the git migration), it has become a bit more complex to build GDB. Of course, you can still do a simple ./configure && make, but you might actually want to disable a few projects that don't need to be built (and that take a long time to build).

The first thing you will have to do is to clone the GDB repository. See this page for instructions on how to do that.

The command line to build GDB today, assuming you're not inside the source tree (which is named binutils-gdb/ in this example), is:

../binutils-gdb/configure --disable-binutils --disable-ld --disable-gold --disable-gas --disable-sim --disable-gprof

In-tree builds don't currently work (and haven't worked for some time now), so you will need to build out-of-tree.

Build flags

GDB is now a C++ program, so you need to provide the build flags using the CXXFLAGS environment variable:

../binutils-gdb/configure --disable-binutils --disable-ld --disable-gold --disable-gas --disable-sim --disable-gprof CXXFLAGS='-g3 -O0' CFLAGS='-g3 -O0'

Making GDB use the debuginfo files from your distro

Your distribution may install debuginfo files for GDB to use, so it's a good idea to tell GDB to use them by default. You can do that by specifying the --with-separate-debug-dir option to the configure script, like:

../binutils-gdb/configure --disable-binutils --disable-ld --disable-gold --disable-gas --disable-sim --disable-gprof --with-separate-debug-dir=/usr/lib/debug

If you forgot to specify this flag during the build, you can still pass it to GDB by using the set debug-file-directory command.

None: BuildingNatively (last edited 2019-06-28 21:39:52 by SergioDuriganJr)

All content (C) 2008 Free Software Foundation. For terms of use, redistribution, and modification, please see the WikiLicense page.