Building GDB requires various tools and packages to be available. Other packages will be used only if they are found.
GDB is written in C++17. It should be buildable with any recent C++17 compiler, e.g. GCC.
GDB’s build system relies on features only found in the GNU
make program. Other variants of
make will not work.
The following libraries are mandatory for building GDB. The configure script searches for each of these libraries in several standard locations; if some library is installed in an unusual place, you can use either the --with-lib configure option to specify its installation directory, or the two separate options ---with-library-include (to specify the location of its header files) and --with-library-lib (to specify the location of its libraries). For example, for the GMP library, the 3 options are --with-gmp, --with-gmp-include, and --with-gmp-lib. See Configure Options. We mention below the home site of each library, so that you could download and install them if your system doesn’t already include them.
GDB uses GMP to perform some of its extended-precision arithmetic. The latest version of GMP is available from https://gmplib.org/.
GDB uses MPFR to emulate the target floating-point arithmetic during expression evaluation, if the target uses different floating-point formats than the host. The latest version of MPFR is available from http://www.mpfr.org.
The tools/packages and libraries listed below are optional; GDB can be build without them, at the expense of some run-time functionality that will be missing. As above, we list the home sites for each package/library, and the command-line options supported by the configure script to specify their installation directories if they are non-standard. In addition, for each package you can use the option --with-package to force GDB to be compiled with the named package, and --without-package to disable building with it even if it is available. See Configure Options, for detailed description of the options to configure.
GDB can be scripted using Python language. See Python. The latest version is available from https://www.python.org/downloads/. Use the --with-python=dir to specify the non-standard directory where Python is installed.
GDB can also be scripted using GNU Guile. See Guile. The latest version can be found on https://www.gnu.org/software/guile/download/. If you have more than one version of Guile installed, use the --with-guile=guile-version to specify the Guile version to include in the build.
If available, GDB uses the Expat library for parsing XML files. GDB uses XML files for the following functionalities:
The latest version of Expat is available from http://expat.sourceforge.net. Use the --with-libexpat-prefix to specify non-standard installation places for Expat.
GDB’s features related to character sets (see Character Sets) require a functioning
iconv implementation. If you are
on a GNU system, then this is provided by the GNU C Library. Some
other systems also provide a working
iconv. Use the option
--with-iconv-bin to specify where to find the
On systems without
iconv, you can install the GNU Libiconv
library; its latest version can be found on
https://ftp.gnu.org/pub/gnu/libiconv/ if your system doesn’t
provide it. Use the --with-libiconv-prefix option to
configure to specify non-standard installation place for it.
Alternatively, GDB’s top-level configure and
Makefile will arrange to build Libiconv if a directory named
libiconv appears in the top-most source directory. If Libiconv
is built this way, and if the operating system does not provide a
iconv implementation, then the just-built library will
automatically be used by GDB. One easy way to set this up is
to download GNU Libiconv, unpack it inside the top-level directory of
the GDB source tree, and then rename the directory holding
the Libiconv source code to ‘libiconv’.
GDB can support debugging sections that are compressed with the LZMA library. See MiniDebugInfo. If this library is not included with your operating system, you can find it in the xz package at http://tukaani.org/xz/. Use the --with-liblzma-prefix option to specify its non-standard location.
GDB will use the ‘zlib’ library, if available, to read
compressed debug sections. Some linkers, such as GNU
are capable of producing binaries with compressed debug sections. If
GDB is compiled with ‘zlib’, it will be able to read the
debug information in such binaries.
The ‘zlib’ library is likely included with your operating system distribution; if it is not, you can get the latest version from http://zlib.net.