Requirements (Debugging with GDB)

### C.1 Requirements for Building GDB ¶

Building GDB requires various tools and packages to be available. Other packages will be used only if they are found.

### Tools/Packages Necessary for Building GDB ¶

C`++`17 compiler

  GDB is written in C`++`17. It should be buildable with any recent C`++`17 compiler, e.g. GCC.

GNU make

  GDB’s build system relies on features only found in the GNU make program. Other variants of `make` will not work.

Libraries

  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.

  GMP (The GNU Multiple Precision arithmetic library)

    GDB uses GMP to perform some of its extended-precision arithmetic. The latest version of GMP is available from https://gmplib.org/.

  MPFR (The GNU Multiple-precision floating-point library)

    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.

### Tools/Packages Optional for Building GDB ¶

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`.

Python

  GDB can be scripted using Python language. See Extending GDB using 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.

Guile

  GDB can also be scripted using GNU Guile. See Extending GDB using 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.

Expat

  If available, GDB uses the Expat library for parsing XML files. GDB uses XML files for the following functionalities:

  - Remote protocol memory maps (see Memory Map Format)
  - Target descriptions (see Target Descriptions)
  - Remote shared library lists (See Library List Format, or alternatively see Library List Format for SVR4 Targets)
  - MS-Windows shared libraries (see Shared Libraries)
  - Traceframe info (see Traceframe Info Format)
  - Branch trace (see Branch Trace Format, see Branch Trace Configuration Format)

  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.

iconv

  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 `iconv` program.

  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 suitable `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`’.

lzma ¶

  GDB can support debugging sections that are compressed with the LZMA library. See Debugging information in a special section. 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.

zlib

  GDB will use the ‘`zlib`’ library, if available, to read compressed debug sections. Some linkers, such as GNU `gold`, 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.