Prerequisites for GCC

GCC requires that various tools and packages be available for use in the build procedure. Modifying GCC sources requires additional tools described below.

Tools/packages necessary for building GCC

ISO C++98 compiler
Necessary to bootstrap GCC, although versions of GCC prior to 4.8 also allow bootstrapping with a ISO C89 compiler and versions of GCC prior to 3.4 also allow bootstrapping with a traditional (K&R) C compiler.

To build all languages in a cross-compiler or other configuration where 3-stage bootstrap is not performed, you need to start with an existing GCC binary (version 3.4 or later) because source code for language frontends other than C might use GCC extensions.

Note that to bootstrap GCC with versions of GCC earlier than 3.4, you may need to use --disable-stage1-checking, though bootstrapping the compiler with such earlier compilers is strongly discouraged.

C standard library and headers
In order to build GCC, the C standard library and headers must be present for all target variants for which target libraries will be built (and not only the variant of the host C++ compiler).

This affects the popular ‘x86_64-unknown-linux-gnu’ platform (among other multilib targets), for which 64-bit (‘x86_64’) and 32-bit (‘i386’) libc headers are usually packaged separately. If you do a build of a native compiler on ‘x86_64-unknown-linux-gnu’, make sure you either have the 32-bit libc developer package properly installed (the exact name of the package depends on your distro) or you must build GCC as a 64-bit only compiler by configuring with the option --disable-multilib. Otherwise, you may encounter an error such as ‘fatal error: gnu/stubs-32.h: No such file

GNAT
In order to build the Ada compiler (GNAT) you must already have GNAT installed because portions of the Ada frontend are written in Ada (with GNAT extensions.) Refer to the Ada installation instructions for more specific information.
A “working” POSIX compatible shell, or GNU bash
Necessary when running configure because some /bin/sh shells have bugs and may crash when configuring the target libraries. In other cases, /bin/sh or ksh have disastrous corner-case performance problems. This can cause target configure runs to literally take days to complete in some cases.

So on some platforms /bin/ksh is sufficient, on others it isn't. See the host/target specific instructions for your platform, or use bash to be sure. Then set CONFIG_SHELL in your environment to your “good” shell prior to running configure/make.

zsh is not a fully compliant POSIX shell and will not work when configuring GCC.

A POSIX or SVR4 awk
Necessary for creating some of the generated source files for GCC. If in doubt, use a recent GNU awk version, as some of the older ones are broken. GNU awk version 3.1.5 is known to work.
GNU binutils
Necessary in some circumstances, optional in others. See the host/target specific instructions for your platform for the exact requirements.
gzip version 1.2.4 (or later) or
bzip2 version 1.0.2 (or later)
Necessary to uncompress GCC tar files when source code is obtained via FTP mirror sites.
GNU make version 3.80 (or later)
You must have GNU make installed to build GCC.
GNU tar version 1.14 (or later)
Necessary (only on some platforms) to untar the source code. Many systems' tar programs will also work, only try GNU tar if you have problems.
Perl version 5.6.1 (or later)
Necessary when targeting Darwin, building ‘libstdc++’, and not using --disable-symvers. Necessary when targeting Solaris 2 with Sun ld and not using --disable-symvers. The bundled perl in Solaris 8 and up works.

Necessary when regenerating Makefile dependencies in libiberty. Necessary when regenerating libiberty/functions.texi. Necessary when generating manpages from Texinfo manuals. Used by various scripts to generate some files included in SVN (mainly Unicode-related and rarely changing) from source tables.

jar, or InfoZIP (zip and unzip)
Necessary to build libgcj, the GCJ runtime.

Several support libraries are necessary to build GCC, some are required, others optional. While any sufficiently new version of required tools usually work, library requirements are generally stricter. Newer versions may work in some cases, but it's safer to use the exact versions documented. We appreciate bug reports about problems with newer versions, though. If your OS vendor provides packages for the support libraries then using those packages may be the simplest way to install the libraries.

GNU Multiple Precision Library (GMP) version 4.3.2 (or later)
Necessary to build GCC. If a GMP source distribution is found in a subdirectory of your GCC sources named gmp, it will be built together with GCC. Alternatively, if GMP is already installed but it is not in your library search path, you will have to configure with the --with-gmp configure option. See also --with-gmp-lib and --with-gmp-include.
MPFR Library version 2.4.2 (or later)
Necessary to build GCC. It can be downloaded from http://www.mpfr.org/. If an MPFR source distribution is found in a subdirectory of your GCC sources named mpfr, it will be built together with GCC. Alternatively, if MPFR is already installed but it is not in your default library search path, the --with-mpfr configure option should be used. See also --with-mpfr-lib and --with-mpfr-include.
MPC Library version 0.8.1 (or later)
Necessary to build GCC. It can be downloaded from http://www.multiprecision.org/. If an MPC source distribution is found in a subdirectory of your GCC sources named mpc, it will be built together with GCC. Alternatively, if MPC is already installed but it is not in your default library search path, the --with-mpc configure option should be used. See also --with-mpc-lib and --with-mpc-include.
ISL Library version 0.14 (or 0.12.2)
Necessary to build GCC with the Graphite loop optimizations. It can be downloaded from ftp://gcc.gnu.org/pub/gcc/infrastructure/ as isl-0.12.2.tar.bz2. If an ISL source distribution is found in a subdirectory of your GCC sources named isl, it will be built together with GCC. Alternatively, the --with-isl configure option should be used if ISL is not installed in your default library search path.

Tools/packages necessary for modifying GCC

autoconf version 2.64
GNU m4 version 1.4.6 (or later)
Necessary when modifying configure.ac, aclocal.m4, etc. to regenerate configure and config.in files.
automake version 1.11.1
Necessary when modifying a Makefile.am file to regenerate its associated Makefile.in.

Much of GCC does not use automake, so directly edit the Makefile.in file. Specifically this applies to the gcc, intl, libcpp, libiberty, libobjc directories as well as any of their subdirectories.

For directories that use automake, GCC requires the latest release in the 1.11 series, which is currently 1.11.1. When regenerating a directory to a newer version, please update all the directories using an older 1.11 to the latest released version.

gettext version 0.14.5 (or later)
Needed to regenerate gcc.pot.
gperf version 2.7.2 (or later)
Necessary when modifying gperf input files, e.g. gcc/cp/cfns.gperf to regenerate its associated header file, e.g. gcc/cp/cfns.h.
DejaGnu 1.4.4
Expect
Tcl
Necessary to run the GCC testsuite; see the section on testing for details. Tcl 8.6 has a known regression in RE pattern handling that make parts of the testsuite fail. See http://core.tcl.tk/tcl/tktview/267b7e2334ee2e9de34c4b00d6e72e2f1997085f for more information. This bug has been fixed in 8.6.1.
autogen version 5.5.4 (or later) and
guile version 1.4.1 (or later)
Necessary to regenerate fixinc/fixincl.x from fixinc/inclhack.def and fixinc/*.tpl.

Necessary to run ‘make check’ for fixinc.

Necessary to regenerate the top level Makefile.in file from Makefile.tpl and Makefile.def.

Flex version 2.5.4 (or later)
Necessary when modifying *.l files.

Necessary to build GCC during development because the generated output files are not included in the SVN repository. They are included in releases.

Texinfo version 4.7 (or later)
Necessary for running makeinfo when modifying *.texi files to test your changes.

Necessary for running make dvi or make pdf to create printable documentation in DVI or PDF format. Texinfo version 4.8 or later is required for make pdf.

Necessary to build GCC documentation during development because the generated output files are not included in the SVN repository. They are included in releases.

TeX (any working version)
Necessary for running texi2dvi and texi2pdf, which are used when running make dvi or make pdf to create DVI or PDF files, respectively.
Sphinx version 1.0 (or later)
Necessary to regenerate jit/docs/_build/texinfo from the .rst files in the directories below jit/docs.
SVN (any version)
SSH (any version)
Necessary to access the SVN repository. Public releases and weekly snapshots of the development sources are also available via FTP.
GNU diffutils version 2.7 (or later)
Useful when submitting patches for the GCC source code.
patch version 2.5.4 (or later)
Necessary when applying patches, created with diff, to one's own sources.
ecj1
gjavah
If you wish to modify .java files in libjava, you will need to configure with --enable-java-maintainer-mode, and you will need to have executables named ecj1 and gjavah in your path. The ecj1 executable should run the Eclipse Java compiler via the GCC-specific entry point. You can download a suitable jar from ftp://sourceware.org/pub/java/, or by running the script contrib/download_ecj.
antlr.jar version 2.7.1 (or later)
antlr binary
If you wish to build the gjdoc binary in libjava, you will need to have an antlr.jar library available. The library is searched for in system locations but can be specified with --with-antlr-jar= instead. When configuring with --enable-java-maintainer-mode, you will need to have one of the executables named cantlr, runantlr or antlr in your path.


Return to the GCC Installation page