Movatterモバイル変換


[0]ホーム

URL:


Prerequisites for GCC

GCC requires that various tools and packages be available for use in thebuild procedure. Modifying GCC sources requires additional toolsdescribed below.

Tools/packages necessary for building GCC

ISO C++14 compiler

Necessary to bootstrap GCC. GCC 5.4 or newer has sufficient supportfor used C++14 features.

Versions of GCC prior to 15 allow bootstrapping with an ISO C++11compiler, versions prior to 10.5 allow bootstrapping with an ISO C++98compiler, and versions prior to 4.8 allow bootstrapping with an ISOC89 compiler.

If you need to build an intermediate version of GCC in order tobootstrap current GCC, consider GCC 9.5: it can build the current Dcompiler, and was also the version that declared C++17 support stable.

To build all languages in a cross-compiler or other configuration where3-stage bootstrap is not performed, you need to start with an existingGCC binary (of a new enough version) because source code for languagefrontends other than C might use GCC extensions.

C standard library and headers

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

This affects the popular ‘x86_64-pc-linux-gnu’ platform (amongother multilib targets), for which 64-bit (‘x86_64’) and 32-bit(‘i386’) libc headers are usually packaged separately. If you do abuild of a native compiler on ‘x86_64-pc-linux-gnu’, make sure youeither have the 32-bit libc developer package properly installed (the exactname of the package depends on your distro) or you must build GCC as a64-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

Python

If you configure a RISC-V compiler with the option--with-arch andthe specified architecture string is non-canonical, then you will needpython installed on the build system.

GNAT

In order to build GNAT, the Ada compiler, you need a working GNATcompiler (GCC version 5.4 or later).

This includes GNAT tools such asgnatmake andgnatlink, since the Ada front end is written in Ada anduses some GNAT-specific extensions.

In order to build a cross compiler, it is strongly recommended to installthe new compiler as native first, and then use it to build the crosscompiler. Other native compiler versions may work but this is not guaranteed andwill typically fail with hard to understand compilation errors during thebuild.

Similarly, it is strongly recommended to use an older version of GNAT to buildGNAT. More recent versions of GNAT than the version built are not guaranteedto work and will often fail during the build with compilation errors.

Note thatconfigure does not test whether the GNAT installation worksand has a sufficiently recent version; if too old a GNAT version isinstalled and--enable-languages=ada is used, the build will fail.

ADA_INCLUDE_PATH andADA_OBJECT_PATH environment variablesmust not be set when building the Ada compiler, the Ada tools, or theAda runtime libraries. You can check that your build environment is cleanby verifying that ‘gnatls -v’ lists only one explicit path in eachsection.

GCOBOL

The COBOL compiler, gcobol, first appeared in GCC 15. To build theCOBOL parser, you need GNU Bison 3.5.1 or later (but not 3.8.0). To buildthe lexer requires GNU Flex 2.6.4, the current version as of this writing,released on 2017-05-06.

The gcobol documentation is maintained as manpages using troffmdoc. GNU groff is required to convert them to PDF format. Conversionto HTML is done with mandoc, available athttps://mandoc.bsd.lv.

The COBOL runtime library. libgcobol, requires libxml2 2.9 or later.It implements support forXML PARSE.

Because ISO COBOL defines strict requirements for numerical precision,gcobol computes with 128-bit operands. This requirement applies toboth host and target. For integers, gcobol requires the platform tosupport the GCC__int128 type. For floating point it uses_Float128 or similar.

gcobol has so far been tested on two architectures only: x86_64 andaarch64 with little-endian encoding.

GDC

In order to build GDC, the D compiler, you need a working GDC compiler(GCC version 9.4 or later) and D runtime library, ‘libphobos’, asthe D front end is written in D.

Versions of GDC prior to 12 can be built with an ISO C++11 compiler, which canthen be installed and used to bootstrap newer versions of the D front end.

It is strongly recommended to use an older version of GDC to build GDC. Morerecent versions of GDC than the version built are not guaranteed to work andwill often fail during the build with compilation errors relating todeprecations or removed features.

Note thatconfigure does not test whether the GDC installation worksand has a sufficiently recent version. Though the implementation of the Dfront end does not make use of any GDC-specific extensions, or novel featuresof the D language, if too old a GDC version is installed and--enable-languages=d is used, the build will fail.

On some targets, ‘libphobos’ isn’t enabled by default, but compilesand works if--enable-libphobos is used. Specifics aredocumented for affected targets.

GM2

Python3 is required if you want to build the complete Modula-2documentation including the targetSYSTEM definition module.If Python3 is unavailable Modula-2 documentation will include a targetindependent version of the SYSTEM modules.

gccrs

The official Rust compiler and Rust build system (cargo) are required forbuilding various parts of the gccrs frontend, until gccrs can compile themby itself. The minimum supported Rust version is 1.49.

A “working” POSIX compatible shell, or GNU bash

Necessary when runningconfigure because some/bin/sh shells have bugs and may crash when configuring thetarget libraries. In other cases,/bin/sh orkshhave disastrous corner-case performance problems. Thiscan cause targetconfigure runs to literally take days tocomplete in some cases.

So on some platforms/bin/ksh is sufficient, on others itisn’t. See the host/target specific instructions for your platform, orusebash to be sure. Then setCONFIG_SHELL in yourenvironment to your “good” shell prior to runningconfigure/make.

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

GNU flex

Necessary to build the lexical analysis module.

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.

GNU Binutils

Necessary in some circumstances, optional in others. See thehost/target specific instructions for your platform for the exactrequirements.

Note binutils 2.35 or newer is required for LTO to work correctlywith GNU libtool that includes doing a bootstrap with LTO enabled.

gzip version 1.2.4 (or later) or
xz version 5.0 (or later)

Necessary to uncompress GCCtar files when source code isobtained via HTTPS 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. Manysystems’tar programs will also work, only try GNUtar 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 with Solarisld and not using--disable-symvers.

Necessary when regeneratingMakefile dependencies in libiberty.Necessary when regeneratinglibiberty/functions.texi.Necessary when generating manpages from Texinfo manuals.Used by various scripts to generate some files included in the sourcerepository (mainly Unicode-related and rarely changing) from sourcetables.

Used byautomake.

If available, enables parallel testing of ‘libgomp’ in case thatflock is not available.

Several support libraries are necessary to build GCC, some are required,others optional. While any sufficiently new version of required toolsusually work, library requirements are generally stricter. Newerversions may work in some cases, but it’s safer to use the exactversions documented. We appreciate bug reports about problems withnewer versions, though. If your OS vendor provides packages for thesupport libraries then using those packages may be the simplest way toinstall the libraries.

GNU Multiple Precision Library (GMP) version 4.3.2 (or later)

Necessary to build GCC. It can be downloaded fromhttps://gmplib.org/. If a GMP source distribution is found in asubdirectory of your GCC sources namedgmp, it will be builttogether with GCC. Alternatively, if GMP is already installed but itis not in your library search path, you will have to configure with the--with-gmp configure option. See also--with-gmp-liband--with-gmp-include.The in-tree build is only supported with the GMP version thatdownload_prerequisites installs.

MPFR Library version 3.1.0 (or later)

Necessary to build GCC. It can be downloaded fromhttps://www.mpfr.org. If an MPFR source distribution is foundin a subdirectory of your GCC sources namedmpfr, it will bebuilt together with GCC. Alternatively, if MPFR is already installedbut 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.The in-tree build is only supported with the MPFR version thatdownload_prerequisites installs.

MPC Library version 1.0.1 (or later)

Necessary to build GCC. It can be downloaded fromhttps://www.multiprecision.org/mpc/. If an MPC source distributionis found in a subdirectory of your GCC sources namedmpc, itwill be built together with GCC. Alternatively, if MPC is alreadyinstalled 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.The in-tree build is only supported with the MPC version thatdownload_prerequisites installs.

isl Library version 0.15 or later.

Necessary to build GCC with the Graphite loop optimizations.It can be downloaded fromhttps://gcc.gnu.org/pub/gcc/infrastructure/.If an isl source distribution is foundin a subdirectory of your GCC sources namedisl, it will bebuilt together with GCC. Alternatively, the--with-isl configureoption should be used if isl is not installed in your default librarysearch path.

zstd Library.

Necessary to build GCC with zstd compression used for LTO bytecode.The library is searched in your default library patch search.Alternatively, the--with-zstd configure option should be used.

Python3 modules

The complete list of Python3 modules broken down by GCC subcomponentis shown below:

internal debugging in gdbhooks

gdb,gdb.printing,gdb.types,os.path,re,sys andtempfile,

g++ testsuite

gcov,gzip,json,os andpytest.

SARIF testsuite

Tests of SARIF output will use thecheck-jsonschema program fromthecheck-jsonschema module (if available) to validate generated.sarif files. If this tool is not found, the validation parts of thosetests are skipped.

c++ cxx api generation

csv,os,sys andtime.

modula-2 documentation

argparse,os,pathlib,shutil andsys.

git developer tools

os andsys.

ada documentation

latex_elements,os,pygments,re,sys andtime.

GNU gettext

Necessary to build GCC with internationalization support via--enable-nls. It can be downloaded fromhttps://www.gnu.org/software/gettext/. If a GNU gettext distributionis found in a subdirectory of your GCC sources namedgettext, itwill be built together with GCC, unless present in the system (either inlibc or as a stand-alone library).

The in-tree configuration requires GNU gettext version 0.22 or later.

Tools/packages necessary for modifying GCC

autoconf version 2.69
GNU m4 version 1.4.6 (or later)

Necessary when modifyingconfigure.ac,aclocal.m4, etc.to regenerateconfigure andconfig.in files.

automake version 1.15.1

Necessary when modifying aMakefile.am file to regenerate itsassociatedMakefile.in.

Much of GCC does not use automake, so directly edit theMakefile.infile. Specifically this applies to thegcc,intl,libcpp,libiberty,libobjc directories as wellas any of their subdirectories.

For directories that use automake, GCC requires the latest release inthe 1.15 series, which is currently 1.15.1. When regenerating a directoryto a newer version, please update all the directories using an older 1.15to the latest released version.

gettext version 0.14.5 (or later)

Needed to regenerategcc.pot.

gperf version 2.7.2 (or later)

Necessary when modifyinggperf input files, e.g.gcc/cp/cfns.gperf to regenerate its associated header file, e.g.gcc/cp/cfns.h.

DejaGnu version 1.5.3 (or later)
Expect
Tcl

Necessary to run the GCC testsuite; see the section on testing fordetails.

autogen version 5.5.4 (or later) and
guile version 1.4.1 (or later)

Necessary to regeneratefixinc/fixincl.x fromfixinc/inclhack.def andfixinc/*.tpl.

Necessary to run ‘make check’ forfixinc.

Necessary to regenerate the top levelMakefile.in file fromMakefile.tpl andMakefile.def.

Necessary to regenerate thebits/version.h header for libstdc++.

Flex version 2.5.4 (or later)

Necessary when modifying*.l files.

Necessary to build GCC during development because the generated outputfiles are not included in the version-controlled source repository.They are included in releases.

Bison version 3.5.1 or later (but not 3.8.0)

Necessary when modifying*.y files in the COBOL front end.

Necessary to build GCC during development because the generated outputfiles are not included in the version-controlled source repository.They are included in releases.

Texinfo version 4.7 (or later)

Necessary for runningmakeinfo when modifying*.texifiles to test your changes.

Necessary for runningmake dvi,make pdf,ormake html to create formatted documentation. Texinfo version4.8 or later is required formake pdf.

Necessary to build GCC documentation in info format during developmentbecause the generated output files are not included in the repository.(They are included in release tarballs.)

Note that the minimum requirement is for a very old version ofTexinfo, but recent versions of Texinfo produce better-quality output,especially for HTML format. The version of Texinfo packaged with anycurrent operating system distribution is likely to be adequate forbuilding the documentation without error, but you may still want toinstall a newer release to get the best appearance and usability ofthe generated manuals.

Also note that Texinfo older than version 7.1 may throw incorrect buildwarnings, though the generated documentation is correct.

TeX (any working version)

Necessary for runningtexi2dvi andtexi2pdf, whichare used when runningmake dvi ormake pdf to createDVI or PDF files, respectively.

Sphinx version 1.0 (or later)

Necessary to regeneratejit/docs/_build/texinfo from the.rstfiles in the directories belowjit/docs.

git (any version)
SSH (any version)

Necessary to access the source repository. Public releases and weeklysnapshots of the development sources are also available via HTTPS.

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 withdiff, to one’sown sources.


Return to the GCC Installation page

For questions related to the use of GCC,please consult these web pages and theGCC manuals. If that fails,thegcc-help@gcc.gnu.orgmailing list might help.Comments on these web pages and the development of GCC are welcome on ourdeveloper list atgcc@gcc.gnu.org.All ofour listshave public archives.

Copyright (C)Free Software Foundation, Inc.Verbatim copying and distribution of this entire article ispermitted in any medium, provided this notice is preserved.

These pages aremaintained by the GCC team.Last modified 2026-01-07.


[8]ページ先頭

©2009-2026 Movatter.jp