Home | History | Annotate | Line # | Download | only in INSTALL
prerequisites.html revision 1.17
      1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      2 <html>
      3 <!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
      4 <head>
      5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      6 <!-- Copyright (C) 1988-2022 Free Software Foundation, Inc.
      7 
      8 Permission is granted to copy, distribute and/or modify this document
      9 under the terms of the GNU Free Documentation License, Version 1.3 or
     10 any later version published by the Free Software Foundation; with no
     11 Invariant Sections, the Front-Cover texts being (a) (see below), and
     12 with the Back-Cover Texts being (b) (see below).  A copy of the
     13 license is included in the section entitled "GNU
     14 Free Documentation License".
     15 
     16 (a) The FSF's Front-Cover Text is:
     17 
     18 A GNU Manual
     19 
     20 (b) The FSF's Back-Cover Text is:
     21 
     22 You have freedom to copy and modify this GNU Manual, like GNU
     23      software.  Copies published by the Free Software Foundation raise
     24      funds for GNU development. -->
     25 <title>Prerequisites for GCC</title>
     26 
     27 <meta name="description" content="Prerequisites for GCC">
     28 <meta name="keywords" content="Prerequisites for GCC">
     29 <meta name="resource-type" content="document">
     30 <meta name="distribution" content="global">
     31 <meta name="Generator" content="makeinfo">
     32 <meta name="viewport" content="width=device-width,initial-scale=1">
     33 
     34 <style type="text/css">
     35 <!--
     36 a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em}
     37 a.summary-letter {text-decoration: none}
     38 blockquote.indentedblock {margin-right: 0em}
     39 div.display {margin-left: 3.2em}
     40 div.example {margin-left: 3.2em}
     41 kbd {font-style: oblique}
     42 pre.display {font-family: inherit}
     43 pre.format {font-family: inherit}
     44 pre.menu-comment {font-family: serif}
     45 pre.menu-preformatted {font-family: serif}
     46 span.nolinebreak {white-space: nowrap}
     47 span.roman {font-family: initial; font-weight: normal}
     48 span.sansserif {font-family: sans-serif; font-weight: normal}
     49 span:hover a.copiable-anchor {visibility: visible}
     50 ul.no-bullet {list-style: none}
     51 -->
     52 </style>
     53 
     54 
     55 </head>
     56 
     57 <body lang="en">
     58 <h1 class="settitle" align="center">Prerequisites for GCC</h1>
     59 
     60 
     61 
     62 
     63 
     64 
     65 
     66 
     67 
     68 
     69 
     70 
     71 
     72 
     73 
     74 
     75 
     76 <span id="index-Prerequisites"></span>
     77 
     78 <p>GCC requires that various tools and packages be available for use in the
     79 build procedure.  Modifying GCC sources requires additional tools
     80 described below.
     81 </p>
     82 <span id="Tools_002fpackages-necessary-for-building-GCC"></span><h3 class="heading">Tools/packages necessary for building GCC</h3>
     83 <dl compact="compact">
     84 <dt><span>ISO C++11 compiler</span></dt>
     85 <dd><p>Necessary to bootstrap GCC.  GCC 4.8.3 or newer has sufficient
     86 support for used C++11 features, with earlier GCC versions you
     87 might run into implementation bugs.
     88 </p>
     89 <p>Versions of GCC prior to 11 also allow bootstrapping with an ISO C++98
     90 compiler, versions of GCC prior to 4.8 also allow bootstrapping with a
     91 ISO C89 compiler, and versions of GCC prior to 3.4 also allow
     92 bootstrapping with a traditional (K&amp;R) C compiler.
     93 </p>
     94 <p>To build all languages in a cross-compiler or other configuration where
     95 3-stage bootstrap is not performed, you need to start with an existing
     96 GCC binary (version 4.8.3 or later) because source code for language
     97 frontends other than C might use GCC extensions.
     98 </p>
     99 </dd>
    100 <dt><span>C standard library and headers</span></dt>
    101 <dd>
    102 <p>In order to build GCC, the C standard library and headers must be present
    103 for all target variants for which target libraries will be built (and not
    104 only the variant of the host C++ compiler).
    105 </p>
    106 <p>This affects the popular &lsquo;<samp>x86_64-pc-linux-gnu</samp>&rsquo; platform (among
    107 other multilib targets), for which 64-bit (&lsquo;<samp>x86_64</samp>&rsquo;) and 32-bit
    108 (&lsquo;<samp>i386</samp>&rsquo;) libc headers are usually packaged separately. If you do a
    109 build of a native compiler on &lsquo;<samp>x86_64-pc-linux-gnu</samp>&rsquo;, make sure you
    110 either have the 32-bit libc developer package properly installed (the exact
    111 name of the package depends on your distro) or you must build GCC as a
    112 64-bit only compiler by configuring with the option
    113 <samp>--disable-multilib</samp>.  Otherwise, you may encounter an error such as
    114 &lsquo;<samp>fatal error: gnu/stubs-32.h: No such file</samp>&rsquo;
    115 </p>
    116 </dd>
    117 <dt><span><span id="GNAT-prerequisite"></span>GNAT</span></dt>
    118 <dd>
    119 <p>In order to build GNAT, the Ada compiler, you need a working GNAT
    120 compiler (GCC version 5.1 or later).
    121 </p>
    122 <p>This includes GNAT tools such as <code>gnatmake</code> and
    123 <code>gnatlink</code>, since the Ada front end is written in Ada and
    124 uses some GNAT-specific extensions.
    125 </p>
    126 <p>In order to build a cross compiler, it is strongly recommended to install
    127 the new compiler as native first, and then use it to build the cross
    128 compiler. Other native compiler versions may work but this is not guaranteed and
    129 will typically fail with hard to understand compilation errors during the
    130 build.
    131 </p>
    132 <p>Similarly, it is strongly recommended to use an older version of GNAT to build
    133 GNAT. More recent versions of GNAT than the version built are not guaranteed
    134 to work and will often fail during the build with compilation errors.
    135 </p>
    136 <p>Note that <code>configure</code> does not test whether the GNAT installation works
    137 and has a sufficiently recent version; if too old a GNAT version is
    138 installed and <samp>--enable-languages=ada</samp> is used, the build will fail.
    139 </p>
    140 <p><code>ADA_INCLUDE_PATH</code> and <code>ADA_OBJECT_PATH</code> environment variables
    141 must not be set when building the Ada compiler, the Ada tools, or the
    142 Ada runtime libraries. You can check that your build environment is clean
    143 by verifying that &lsquo;<samp>gnatls -v</samp>&rsquo; lists only one explicit path in each
    144 section.
    145 </p>
    146 </dd>
    147 <dt><span><span id="GDC-prerequisite"></span>GDC</span></dt>
    148 <dd>
    149 <p>In order to build GDC, the D compiler, you need a working GDC
    150 compiler (GCC version 9.4 or later) and D runtime library,
    151 &lsquo;<samp>libphobos</samp>&rsquo;, as the D front end is written in D.
    152 </p>
    153 <p>Versions of GDC prior to 12 can be built with an ISO C++11 compiler, which can
    154 then be installed and used to bootstrap newer versions of the D front end.
    155 </p>
    156 <p>It is strongly recommended to use an older version of GDC to build GDC. More
    157 recent versions of GDC than the version built are not guaranteed to work and
    158 will often fail during the build with compilation errors relating to
    159 deprecations or removed features.
    160 </p>
    161 <p>Note that <code>configure</code> does not test whether the GDC installation works
    162 and has a sufficiently recent version.  Though the implementation of the D
    163 front end does not make use of any GDC-specific extensions, or novel features
    164 of the D language, if too old a GDC version is installed and
    165 <samp>--enable-languages=d</samp> is used, the build will fail.
    166 </p>
    167 <p>On some targets, &lsquo;<samp>libphobos</samp>&rsquo; isn&rsquo;t enabled by default, but compiles
    168 and works if <samp>--enable-libphobos</samp> is used.  Specifics are
    169 documented for affected targets.
    170 </p>
    171 </dd>
    172 <dt><span>A &ldquo;working&rdquo; POSIX compatible shell, or GNU bash</span></dt>
    173 <dd>
    174 <p>Necessary when running <code>configure</code> because some
    175 <code>/bin/sh</code> shells have bugs and may crash when configuring the
    176 target libraries.  In other cases, <code>/bin/sh</code> or <code>ksh</code>
    177 have disastrous corner-case performance problems.  This
    178 can cause target <code>configure</code> runs to literally take days to
    179 complete in some cases.
    180 </p>
    181 <p>So on some platforms <code>/bin/ksh</code> is sufficient, on others it
    182 isn&rsquo;t.  See the host/target specific instructions for your platform, or
    183 use <code>bash</code> to be sure.  Then set <code>CONFIG_SHELL</code> in your
    184 environment to your &ldquo;good&rdquo; shell prior to running
    185 <code>configure</code>/<code>make</code>.
    186 </p>
    187 <p><code>zsh</code> is not a fully compliant POSIX shell and will not
    188 work when configuring GCC.
    189 </p>
    190 </dd>
    191 <dt><span>A POSIX or SVR4 awk</span></dt>
    192 <dd>
    193 <p>Necessary for creating some of the generated source files for GCC.
    194 If in doubt, use a recent GNU awk version, as some of the older ones
    195 are broken.  GNU awk version 3.1.5 is known to work.
    196 </p>
    197 </dd>
    198 <dt><span>GNU binutils</span></dt>
    199 <dd>
    200 <p>Necessary in some circumstances, optional in others.  See the
    201 host/target specific instructions for your platform for the exact
    202 requirements.
    203 </p>
    204 <p>Note binutils 2.35 or newer is required for LTO to work correctly
    205 with GNU libtool that includes doing a bootstrap with LTO enabled.
    206 </p>
    207 </dd>
    208 <dt><span>gzip version 1.2.4 (or later) or</span></dt>
    209 <dt><span>bzip2 version 1.0.2 (or later)</span></dt>
    210 <dd>
    211 <p>Necessary to uncompress GCC <code>tar</code> files when source code is
    212 obtained via HTTPS mirror sites.
    213 </p>
    214 </dd>
    215 <dt><span>GNU make version 3.80 (or later)</span></dt>
    216 <dd>
    217 <p>You must have GNU make installed to build GCC.
    218 </p>
    219 </dd>
    220 <dt><span>GNU tar version 1.14 (or later)</span></dt>
    221 <dd>
    222 <p>Necessary (only on some platforms) to untar the source code.  Many
    223 systems&rsquo; <code>tar</code> programs will also work, only try GNU
    224 <code>tar</code> if you have problems.
    225 </p>
    226 </dd>
    227 <dt><span>Perl version between 5.6.1 and 5.6.24</span></dt>
    228 <dd>
    229 <p>Necessary when targeting Darwin, building &lsquo;<samp>libstdc++</samp>&rsquo;,
    230 and not using <samp>--disable-symvers</samp>.
    231 Necessary when targeting Solaris 2 with Solaris <code>ld</code> and not using
    232 <samp>--disable-symvers</samp>.
    233 </p>
    234 <p>Necessary when regenerating <samp>Makefile</samp> dependencies in libiberty.
    235 Necessary when regenerating <samp>libiberty/functions.texi</samp>.
    236 Necessary when generating manpages from Texinfo manuals.
    237 Used by various scripts to generate some files included in the source
    238 repository (mainly Unicode-related and rarely changing) from source
    239 tables.
    240 </p>
    241 <p>Used by <code>automake</code>.
    242 </p>
    243 <p>If available, enables parallel testing of &lsquo;<samp>libgomp</samp>&rsquo; in case that
    244 <code>flock</code> is not available.
    245 </p>
    246 </dd>
    247 </dl>
    248 
    249 <p>Several support libraries are necessary to build GCC, some are required,
    250 others optional.  While any sufficiently new version of required tools
    251 usually work, library requirements are generally stricter.  Newer
    252 versions may work in some cases, but it&rsquo;s safer to use the exact
    253 versions documented.  We appreciate bug reports about problems with
    254 newer versions, though.  If your OS vendor provides packages for the
    255 support libraries then using those packages may be the simplest way to
    256 install the libraries.
    257 </p>
    258 <dl compact="compact">
    259 <dt><span>GNU Multiple Precision Library (GMP) version 4.3.2 (or later)</span></dt>
    260 <dd>
    261 <p>Necessary to build GCC.  If a GMP source distribution is found in a
    262 subdirectory of your GCC sources named <samp>gmp</samp>, it will be built
    263 together with GCC.  Alternatively, if GMP is already installed but it
    264 is not in your library search path, you will have to configure with the
    265 <samp>--with-gmp</samp> configure option.  See also <samp>--with-gmp-lib</samp>
    266 and <samp>--with-gmp-include</samp>.
    267 The in-tree build is only supported with the GMP version that
    268 download_prerequisites installs.
    269 </p>
    270 </dd>
    271 <dt><span>MPFR Library version 3.1.0 (or later)</span></dt>
    272 <dd>
    273 <p>Necessary to build GCC.  It can be downloaded from
    274 <a href="https://www.mpfr.org">https://www.mpfr.org</a>.  If an MPFR source distribution is found
    275 in a subdirectory of your GCC sources named <samp>mpfr</samp>, it will be
    276 built together with GCC.  Alternatively, if MPFR is already installed
    277 but it is not in your default library search path, the
    278 <samp>--with-mpfr</samp> configure option should be used.  See also
    279 <samp>--with-mpfr-lib</samp> and <samp>--with-mpfr-include</samp>.
    280 The in-tree build is only supported with the MPFR version that
    281 download_prerequisites installs.
    282 </p>
    283 </dd>
    284 <dt><span>MPC Library version 1.0.1 (or later)</span></dt>
    285 <dd>
    286 <p>Necessary to build GCC.  It can be downloaded from
    287 <a href="https://www.multiprecision.org/mpc/">https://www.multiprecision.org/mpc/</a>.  If an MPC source distribution
    288 is found in a subdirectory of your GCC sources named <samp>mpc</samp>, it
    289 will be built together with GCC.  Alternatively, if MPC is already
    290 installed but it is not in your default library search path, the
    291 <samp>--with-mpc</samp> configure option should be used.  See also
    292 <samp>--with-mpc-lib</samp> and <samp>--with-mpc-include</samp>.
    293 The in-tree build is only supported with the MPC version that
    294 download_prerequisites installs.
    295 </p>
    296 </dd>
    297 <dt><span>isl Library version 0.15 or later.</span></dt>
    298 <dd>
    299 <p>Necessary to build GCC with the Graphite loop optimizations.
    300 It can be downloaded from <a href="https://gcc.gnu.org/pub/gcc/infrastructure/">https://gcc.gnu.org/pub/gcc/infrastructure/</a>.
    301 If an isl source distribution is found
    302 in a subdirectory of your GCC sources named <samp>isl</samp>, it will be
    303 built together with GCC.  Alternatively, the <samp>--with-isl</samp> configure
    304 option should be used if isl is not installed in your default library
    305 search path.
    306 </p>
    307 </dd>
    308 <dt><span>zstd Library.</span></dt>
    309 <dd>
    310 <p>Necessary to build GCC with zstd compression used for LTO bytecode.
    311 The library is searched in your default library patch search.
    312 Alternatively, the <samp>--with-zstd</samp> configure option should be used.
    313 </p>
    314 </dd>
    315 </dl>
    316 
    317 <span id="Tools_002fpackages-necessary-for-modifying-GCC"></span><h3 class="heading">Tools/packages necessary for modifying GCC</h3>
    318 <dl compact="compact">
    319 <dt><span>autoconf version 2.69</span></dt>
    320 <dt><span>GNU m4 version 1.4.6 (or later)</span></dt>
    321 <dd>
    322 <p>Necessary when modifying <samp>configure.ac</samp>, <samp>aclocal.m4</samp>, etc.
    323 to regenerate <samp>configure</samp> and <samp>config.in</samp> files.
    324 </p>
    325 </dd>
    326 <dt><span>automake version 1.15.1</span></dt>
    327 <dd>
    328 <p>Necessary when modifying a <samp>Makefile.am</samp> file to regenerate its
    329 associated <samp>Makefile.in</samp>.
    330 </p>
    331 <p>Much of GCC does not use automake, so directly edit the <samp>Makefile.in</samp>
    332 file.  Specifically this applies to the <samp>gcc</samp>, <samp>intl</samp>,
    333 <samp>libcpp</samp>, <samp>libiberty</samp>, <samp>libobjc</samp> directories as well
    334 as any of their subdirectories.
    335 </p>
    336 <p>For directories that use automake, GCC requires the latest release in
    337 the 1.15 series, which is currently 1.15.1.  When regenerating a directory
    338 to a newer version, please update all the directories using an older 1.15
    339 to the latest released version.
    340 </p>
    341 </dd>
    342 <dt><span>gettext version 0.14.5 (or later)</span></dt>
    343 <dd>
    344 <p>Needed to regenerate <samp>gcc.pot</samp>.
    345 </p>
    346 </dd>
    347 <dt><span>gperf version 2.7.2 (or later)</span></dt>
    348 <dd>
    349 <p>Necessary when modifying <code>gperf</code> input files, e.g.
    350 <samp>gcc/cp/cfns.gperf</samp> to regenerate its associated header file, e.g.
    351 <samp>gcc/cp/cfns.h</samp>.
    352 </p>
    353 </dd>
    354 <dt><span>DejaGnu version 1.5.3 (or later)</span></dt>
    355 <dt><span>Expect</span></dt>
    356 <dt><span>Tcl</span></dt>
    357 <dd>
    358 <p>Necessary to run the GCC testsuite; see the section on testing for
    359 details.
    360 </p>
    361 </dd>
    362 <dt><span>autogen version 5.5.4 (or later) and</span></dt>
    363 <dt><span>guile version 1.4.1 (or later)</span></dt>
    364 <dd>
    365 <p>Necessary to regenerate <samp>fixinc/fixincl.x</samp> from
    366 <samp>fixinc/inclhack.def</samp> and <samp>fixinc/*.tpl</samp>.
    367 </p>
    368 <p>Necessary to run &lsquo;<samp>make check</samp>&rsquo; for <samp>fixinc</samp>.
    369 </p>
    370 <p>Necessary to regenerate the top level <samp>Makefile.in</samp> file from
    371 <samp>Makefile.tpl</samp> and <samp>Makefile.def</samp>.
    372 </p>
    373 </dd>
    374 <dt><span>Flex version 2.5.4 (or later)</span></dt>
    375 <dd>
    376 <p>Necessary when modifying <samp>*.l</samp> files.
    377 </p>
    378 <p>Necessary to build GCC during development because the generated output
    379 files are not included in the version-controlled source repository.
    380 They are included in releases.
    381 </p>
    382 </dd>
    383 <dt><span>Texinfo version 4.7 (or later)</span></dt>
    384 <dd>
    385 <p>Necessary for running <code>makeinfo</code> when modifying <samp>*.texi</samp>
    386 files to test your changes.
    387 </p>
    388 <p>Necessary for running <code>make dvi</code> or <code>make pdf</code> to
    389 create printable documentation in DVI or PDF format.  Texinfo version
    390 4.8 or later is required for <code>make pdf</code>.
    391 </p>
    392 <p>Necessary to build GCC documentation during development because the
    393 generated output files are not included in the repository.  They are
    394 included in releases.
    395 </p>
    396 </dd>
    397 <dt><span>TeX (any working version)</span></dt>
    398 <dd>
    399 <p>Necessary for running <code>texi2dvi</code> and <code>texi2pdf</code>, which
    400 are used when running <code>make dvi</code> or <code>make pdf</code> to create
    401 DVI or PDF files, respectively.
    402 </p>
    403 </dd>
    404 <dt><span>Sphinx version 1.0 (or later)</span></dt>
    405 <dd>
    406 <p>Necessary to regenerate <samp>jit/docs/_build/texinfo</samp> from the <samp>.rst</samp>
    407 files in the directories below <samp>jit/docs</samp>.
    408 </p>
    409 </dd>
    410 <dt><span>git (any version)</span></dt>
    411 <dt><span>SSH (any version)</span></dt>
    412 <dd>
    413 <p>Necessary to access the source repository.  Public releases and weekly
    414 snapshots of the development sources are also available via HTTPS.
    415 </p>
    416 </dd>
    417 <dt><span>GNU diffutils version 2.7 (or later)</span></dt>
    418 <dd>
    419 <p>Useful when submitting patches for the GCC source code.
    420 </p>
    421 </dd>
    422 <dt><span>patch version 2.5.4 (or later)</span></dt>
    423 <dd>
    424 <p>Necessary when applying patches, created with <code>diff</code>, to one&rsquo;s
    425 own sources.
    426 </p>
    427 </dd>
    428 </dl>
    429 
    430 <hr />
    431 <p>
    432 <p><a href="./index.html">Return to the GCC Installation page</a>
    433 </p>
    434 
    435 
    436 
    437 
    438 
    439 
    440 
    441 
    442 
    443 
    444 
    445 
    446 </body>
    447 </html>
    448