1 <!DOCTYPE html> 2 <html> 3 <!-- Created by GNU Texinfo 7.2, https://www.gnu.org/software/texinfo/ --> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 6 <!-- Copyright 1988-2024 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-link {visibility: hidden; text-decoration: none; line-height: 0em} 37 span:hover a.copiable-link {visibility: visible} 38 --> 39 </style> 40 41 42 </head> 43 44 <body lang="en"> 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 <a class="index-entry-id" id="index-Prerequisites"></a> 66 67 <p>GCC requires that various tools and packages be available for use in the 68 build procedure. Modifying GCC sources requires additional tools 69 described below. 70 </p> 71 <h3 class="heading" id="Tools_002fpackages-necessary-for-building-GCC"><span>Tools/packages necessary for building GCC<a class="copiable-link" href="#Tools_002fpackages-necessary-for-building-GCC"> ¶</a></span></h3> 72 <dl class="table"> 73 <dt>ISO C++11 compiler</dt> 74 <dd><p>Necessary to bootstrap GCC. GCC 4.8.3 or newer has sufficient 75 support for used C++11 features, with earlier GCC versions you 76 might run into implementation bugs. 77 </p> 78 <p>Versions of GCC prior to 11 also allow bootstrapping with an ISO C++98 79 compiler, versions of GCC prior to 4.8 also allow bootstrapping with a 80 ISO C89 compiler, and versions of GCC prior to 3.4 also allow 81 bootstrapping with a traditional (K&R) C compiler. 82 </p> 83 <p>To build all languages in a cross-compiler or other configuration where 84 3-stage bootstrap is not performed, you need to start with an existing 85 GCC binary (version 4.8.3 or later) because source code for language 86 frontends other than C might use GCC extensions. 87 </p> 88 </dd> 89 <dt>C standard library and headers</dt> 90 <dd> 91 <p>In order to build GCC, the C standard library and headers must be present 92 for all target variants for which target libraries will be built (and not 93 only the variant of the host C++ compiler). 94 </p> 95 <p>This affects the popular ‘<samp class="samp">x86_64-pc-linux-gnu</samp>’ platform (among 96 other multilib targets), for which 64-bit (‘<samp class="samp">x86_64</samp>’) and 32-bit 97 (‘<samp class="samp">i386</samp>’) libc headers are usually packaged separately. If you do a 98 build of a native compiler on ‘<samp class="samp">x86_64-pc-linux-gnu</samp>’, make sure you 99 either have the 32-bit libc developer package properly installed (the exact 100 name of the package depends on your distro) or you must build GCC as a 101 64-bit only compiler by configuring with the option 102 <samp class="option">--disable-multilib</samp>. Otherwise, you may encounter an error such as 103 ‘<samp class="samp">fatal error: gnu/stubs-32.h: No such file</samp>’ 104 </p> 105 </dd> 106 <dt>Python</dt> 107 <dd><p>If you configure a RISC-V compiler with the option <samp class="option">--with-arch</samp> and 108 the specified architecture string is non-canonical, then you will need 109 <code class="command">python</code> installed on the build system. 110 </p> 111 </dd> 112 <dt><a class="anchor" id="GNAT-prerequisite"></a>GNAT</dt> 113 <dd> 114 <p>In order to build GNAT, the Ada compiler, you need a working GNAT 115 compiler (GCC version 5.1 or later). 116 </p> 117 <p>This includes GNAT tools such as <code class="command">gnatmake</code> and 118 <code class="command">gnatlink</code>, since the Ada front end is written in Ada and 119 uses some GNAT-specific extensions. 120 </p> 121 <p>In order to build a cross compiler, it is strongly recommended to install 122 the new compiler as native first, and then use it to build the cross 123 compiler. Other native compiler versions may work but this is not guaranteed and 124 will typically fail with hard to understand compilation errors during the 125 build. 126 </p> 127 <p>Similarly, it is strongly recommended to use an older version of GNAT to build 128 GNAT. More recent versions of GNAT than the version built are not guaranteed 129 to work and will often fail during the build with compilation errors. 130 </p> 131 <p>Note that <code class="command">configure</code> does not test whether the GNAT installation works 132 and has a sufficiently recent version; if too old a GNAT version is 133 installed and <samp class="option">--enable-languages=ada</samp> is used, the build will fail. 134 </p> 135 <p><code class="env">ADA_INCLUDE_PATH</code> and <code class="env">ADA_OBJECT_PATH</code> environment variables 136 must not be set when building the Ada compiler, the Ada tools, or the 137 Ada runtime libraries. You can check that your build environment is clean 138 by verifying that ‘<samp class="samp">gnatls -v</samp>’ lists only one explicit path in each 139 section. 140 </p> 141 </dd> 142 <dt><a class="anchor" id="GDC-prerequisite"></a>GDC</dt> 143 <dd> 144 <p>In order to build GDC, the D compiler, you need a working GDC 145 compiler (GCC version 9.4 or later) and D runtime library, 146 ‘<samp class="samp">libphobos</samp>’, as the D front end is written in D. 147 </p> 148 <p>Versions of GDC prior to 12 can be built with an ISO C++11 compiler, which can 149 then be installed and used to bootstrap newer versions of the D front end. 150 </p> 151 <p>It is strongly recommended to use an older version of GDC to build GDC. More 152 recent versions of GDC than the version built are not guaranteed to work and 153 will often fail during the build with compilation errors relating to 154 deprecations or removed features. 155 </p> 156 <p>Note that <code class="command">configure</code> does not test whether the GDC installation works 157 and has a sufficiently recent version. Though the implementation of the D 158 front end does not make use of any GDC-specific extensions, or novel features 159 of the D language, if too old a GDC version is installed and 160 <samp class="option">--enable-languages=d</samp> is used, the build will fail. 161 </p> 162 <p>On some targets, ‘<samp class="samp">libphobos</samp>’ isn’t enabled by default, but compiles 163 and works if <samp class="option">--enable-libphobos</samp> is used. Specifics are 164 documented for affected targets. 165 </p> 166 </dd> 167 <dt><a class="anchor" id="GM2-prerequisite"></a>GM2</dt> 168 <dd> 169 <p>Python3 is required if you want to build the complete Modula-2 170 documentation including the target <code class="code">SYSTEM</code> definition module. 171 If Python3 is unavailable Modula-2 documentation will include a target 172 independent version of the SYSTEM modules. 173 </p> 174 </dd> 175 <dt>A “working” POSIX compatible shell, or GNU bash</dt> 176 <dd> 177 <p>Necessary when running <code class="command">configure</code> because some 178 <code class="command">/bin/sh</code> shells have bugs and may crash when configuring the 179 target libraries. In other cases, <code class="command">/bin/sh</code> or <code class="command">ksh</code> 180 have disastrous corner-case performance problems. This 181 can cause target <code class="command">configure</code> runs to literally take days to 182 complete in some cases. 183 </p> 184 <p>So on some platforms <code class="command">/bin/ksh</code> is sufficient, on others it 185 isn’t. See the host/target specific instructions for your platform, or 186 use <code class="command">bash</code> to be sure. Then set <code class="env">CONFIG_SHELL</code> in your 187 environment to your “good” shell prior to running 188 <code class="command">configure</code>/<code class="command">make</code>. 189 </p> 190 <p><code class="command">zsh</code> is not a fully compliant POSIX shell and will not 191 work when configuring GCC. 192 </p> 193 </dd> 194 <dt>GNU flex</dt> 195 <dd> 196 <p>Necessary to build the lexical analysis module. 197 </p> 198 </dd> 199 <dt>A POSIX or SVR4 awk</dt> 200 <dd> 201 <p>Necessary for creating some of the generated source files for GCC. 202 If in doubt, use a recent GNU awk version, as some of the older ones 203 are broken. GNU awk version 3.1.5 is known to work. 204 </p> 205 </dd> 206 <dt>GNU binutils</dt> 207 <dd> 208 <p>Necessary in some circumstances, optional in others. See the 209 host/target specific instructions for your platform for the exact 210 requirements. 211 </p> 212 <p>Note binutils 2.35 or newer is required for LTO to work correctly 213 with GNU libtool that includes doing a bootstrap with LTO enabled. 214 </p> 215 </dd> 216 <dt>gzip version 1.2.4 (or later) or</dt> 217 <dt>bzip2 version 1.0.2 (or later)</dt> 218 <dd> 219 <p>Necessary to uncompress GCC <code class="command">tar</code> files when source code is 220 obtained via HTTPS mirror sites. 221 </p> 222 </dd> 223 <dt>GNU make version 3.80 (or later)</dt> 224 <dd> 225 <p>You must have GNU make installed to build GCC. 226 </p> 227 </dd> 228 <dt>GNU tar version 1.14 (or later)</dt> 229 <dd> 230 <p>Necessary (only on some platforms) to untar the source code. Many 231 systems’ <code class="command">tar</code> programs will also work, only try GNU 232 <code class="command">tar</code> if you have problems. 233 </p> 234 </dd> 235 <dt>Perl version 5.6.1 (or later)</dt> 236 <dd> 237 <p>Necessary when targeting Darwin, building ‘<samp class="samp">libstdc++</samp>’, 238 and not using <samp class="option">--disable-symvers</samp>. 239 Necessary when targeting Solaris with Solaris <code class="command">ld</code> and not using 240 <samp class="option">--disable-symvers</samp>. 241 </p> 242 <p>Necessary when regenerating <samp class="file">Makefile</samp> dependencies in libiberty. 243 Necessary when regenerating <samp class="file">libiberty/functions.texi</samp>. 244 Necessary when generating manpages from Texinfo manuals. 245 Used by various scripts to generate some files included in the source 246 repository (mainly Unicode-related and rarely changing) from source 247 tables. 248 </p> 249 <p>Used by <code class="command">automake</code>. 250 </p> 251 <p>If available, enables parallel testing of ‘<samp class="samp">libgomp</samp>’ in case that 252 <code class="command">flock</code> is not available. 253 </p> 254 </dd> 255 </dl> 256 257 <p>Several support libraries are necessary to build GCC, some are required, 258 others optional. While any sufficiently new version of required tools 259 usually work, library requirements are generally stricter. Newer 260 versions may work in some cases, but it’s safer to use the exact 261 versions documented. We appreciate bug reports about problems with 262 newer versions, though. If your OS vendor provides packages for the 263 support libraries then using those packages may be the simplest way to 264 install the libraries. 265 </p> 266 <dl class="table"> 267 <dt>GNU Multiple Precision Library (GMP) version 4.3.2 (or later)</dt> 268 <dd> 269 <p>Necessary to build GCC. It can be downloaded from 270 <a class="uref" href="https://gmplib.org/">https://gmplib.org/</a>. If a GMP source distribution is found in a 271 subdirectory of your GCC sources named <samp class="file">gmp</samp>, it will be built 272 together with GCC. Alternatively, if GMP is already installed but it 273 is not in your library search path, you will have to configure with the 274 <samp class="option">--with-gmp</samp> configure option. See also <samp class="option">--with-gmp-lib</samp> 275 and <samp class="option">--with-gmp-include</samp>. 276 The in-tree build is only supported with the GMP version that 277 download_prerequisites installs. 278 </p> 279 </dd> 280 <dt>MPFR Library version 3.1.0 (or later)</dt> 281 <dd> 282 <p>Necessary to build GCC. It can be downloaded from 283 <a class="uref" href="https://www.mpfr.org">https://www.mpfr.org</a>. If an MPFR source distribution is found 284 in a subdirectory of your GCC sources named <samp class="file">mpfr</samp>, it will be 285 built together with GCC. Alternatively, if MPFR is already installed 286 but it is not in your default library search path, the 287 <samp class="option">--with-mpfr</samp> configure option should be used. See also 288 <samp class="option">--with-mpfr-lib</samp> and <samp class="option">--with-mpfr-include</samp>. 289 The in-tree build is only supported with the MPFR version that 290 download_prerequisites installs. 291 </p> 292 </dd> 293 <dt>MPC Library version 1.0.1 (or later)</dt> 294 <dd> 295 <p>Necessary to build GCC. It can be downloaded from 296 <a class="uref" href="https://www.multiprecision.org/mpc/">https://www.multiprecision.org/mpc/</a>. If an MPC source distribution 297 is found in a subdirectory of your GCC sources named <samp class="file">mpc</samp>, it 298 will be built together with GCC. Alternatively, if MPC is already 299 installed but it is not in your default library search path, the 300 <samp class="option">--with-mpc</samp> configure option should be used. See also 301 <samp class="option">--with-mpc-lib</samp> and <samp class="option">--with-mpc-include</samp>. 302 The in-tree build is only supported with the MPC version that 303 download_prerequisites installs. 304 </p> 305 </dd> 306 <dt>isl Library version 0.15 or later.</dt> 307 <dd> 308 <p>Necessary to build GCC with the Graphite loop optimizations. 309 It can be downloaded from <a class="uref" href="https://gcc.gnu.org/pub/gcc/infrastructure/">https://gcc.gnu.org/pub/gcc/infrastructure/</a>. 310 If an isl source distribution is found 311 in a subdirectory of your GCC sources named <samp class="file">isl</samp>, it will be 312 built together with GCC. Alternatively, the <samp class="option">--with-isl</samp> configure 313 option should be used if isl is not installed in your default library 314 search path. 315 </p> 316 </dd> 317 <dt>zstd Library.</dt> 318 <dd> 319 <p>Necessary to build GCC with zstd compression used for LTO bytecode. 320 The library is searched in your default library patch search. 321 Alternatively, the <samp class="option">--with-zstd</samp> configure option should be used. 322 </p> 323 </dd> 324 <dt>Python3 modules</dt> 325 <dd> 326 <p>The complete list of Python3 modules broken down by GCC subcomponent 327 is shown below: 328 </p> 329 <dl class="table"> 330 <dt>internal debugging in gdbhooks</dt> 331 <dd><p><code class="code">gdb</code>, <code class="code">gdb.printing</code>, <code class="code">gdb.types</code>, 332 <code class="code">os.path</code>, <code class="code">re</code>, <code class="code">sys</code> and <code class="code">tempfile</code>, 333 </p> 334 </dd> 335 <dt>g++ testsuite</dt> 336 <dd><p><code class="code">gcov</code>, <code class="code">gzip</code>, <code class="code">json</code>, <code class="code">os</code> and <code class="code">pytest</code>. 337 </p> 338 </dd> 339 <dt>SARIF testsuite</dt> 340 <dd><p>Tests of SARIF output will use the <code class="code">check-jsonschema</code> program from 341 the <code class="code">check-jsonschema</code> module (if available) to validate generated 342 .sarif files. If this tool is not found, the validation parts of those 343 tests are skipped. 344 </p> 345 </dd> 346 <dt>c++ cxx api generation</dt> 347 <dd><p><code class="code">csv</code>, <code class="code">os</code>, <code class="code">sys</code> and <code class="code">time</code>. 348 </p> 349 </dd> 350 <dt>modula-2 documentation</dt> 351 <dd><p><code class="code">argparse</code>, <code class="code">os</code>, <code class="code">pathlib</code>, <code class="code">shutil</code> and 352 <code class="code">sys</code>. 353 </p> 354 </dd> 355 <dt>git developer tools</dt> 356 <dd><p><code class="code">os</code> and <code class="code">sys</code>. 357 </p> 358 </dd> 359 <dt>ada documentation</dt> 360 <dd><p><code class="code">latex_elements</code>, <code class="code">os</code>, <code class="code">pygments</code>, <code class="code">re</code>, 361 <code class="code">sys</code> and <code class="code">time</code>. 362 </p></dd> 363 </dl> 364 365 </dd> 366 <dt>GNU gettext</dt> 367 <dd> 368 <p>Necessary to build GCC with internationalization support via 369 <samp class="option">--enable-nls</samp>. It can be downloaded from 370 <a class="uref" href="https://www.gnu.org/software/gettext/">https://www.gnu.org/software/gettext/</a>. If a GNU gettext distribution 371 is found in a subdirectory of your GCC sources named <samp class="file">gettext</samp>, it 372 will be built together with GCC, unless present in the system (either in 373 libc or as a stand-alone library). 374 </p> 375 <p>The in-tree configuration requires GNU gettext version 0.22 or later. 376 </p> 377 </dd> 378 </dl> 379 380 <h3 class="heading" id="Tools_002fpackages-necessary-for-modifying-GCC"><span>Tools/packages necessary for modifying GCC<a class="copiable-link" href="#Tools_002fpackages-necessary-for-modifying-GCC"> ¶</a></span></h3> 381 <dl class="table"> 382 <dt>autoconf version 2.69</dt> 383 <dt>GNU m4 version 1.4.6 (or later)</dt> 384 <dd> 385 <p>Necessary when modifying <samp class="file">configure.ac</samp>, <samp class="file">aclocal.m4</samp>, etc. 386 to regenerate <samp class="file">configure</samp> and <samp class="file">config.in</samp> files. 387 </p> 388 </dd> 389 <dt>automake version 1.15.1</dt> 390 <dd> 391 <p>Necessary when modifying a <samp class="file">Makefile.am</samp> file to regenerate its 392 associated <samp class="file">Makefile.in</samp>. 393 </p> 394 <p>Much of GCC does not use automake, so directly edit the <samp class="file">Makefile.in</samp> 395 file. Specifically this applies to the <samp class="file">gcc</samp>, <samp class="file">intl</samp>, 396 <samp class="file">libcpp</samp>, <samp class="file">libiberty</samp>, <samp class="file">libobjc</samp> directories as well 397 as any of their subdirectories. 398 </p> 399 <p>For directories that use automake, GCC requires the latest release in 400 the 1.15 series, which is currently 1.15.1. When regenerating a directory 401 to a newer version, please update all the directories using an older 1.15 402 to the latest released version. 403 </p> 404 </dd> 405 <dt>gettext version 0.14.5 (or later)</dt> 406 <dd> 407 <p>Needed to regenerate <samp class="file">gcc.pot</samp>. 408 </p> 409 </dd> 410 <dt>gperf version 2.7.2 (or later)</dt> 411 <dd> 412 <p>Necessary when modifying <code class="command">gperf</code> input files, e.g. 413 <samp class="file">gcc/cp/cfns.gperf</samp> to regenerate its associated header file, e.g. 414 <samp class="file">gcc/cp/cfns.h</samp>. 415 </p> 416 </dd> 417 <dt>DejaGnu version 1.5.3 (or later)</dt> 418 <dt>Expect</dt> 419 <dt>Tcl</dt> 420 <dd> 421 <p>Necessary to run the GCC testsuite; see the section on testing for 422 details. 423 </p> 424 </dd> 425 <dt>autogen version 5.5.4 (or later) and</dt> 426 <dt>guile version 1.4.1 (or later)</dt> 427 <dd> 428 <p>Necessary to regenerate <samp class="file">fixinc/fixincl.x</samp> from 429 <samp class="file">fixinc/inclhack.def</samp> and <samp class="file">fixinc/*.tpl</samp>. 430 </p> 431 <p>Necessary to run ‘<samp class="samp">make check</samp>’ for <samp class="file">fixinc</samp>. 432 </p> 433 <p>Necessary to regenerate the top level <samp class="file">Makefile.in</samp> file from 434 <samp class="file">Makefile.tpl</samp> and <samp class="file">Makefile.def</samp>. 435 </p> 436 <p>Necessary to regenerate the <samp class="file">bits/version.h</samp> header for libstdc++. 437 </p> 438 </dd> 439 <dt>Flex version 2.5.4 (or later)</dt> 440 <dd> 441 <p>Necessary when modifying <samp class="file">*.l</samp> files. 442 </p> 443 <p>Necessary to build GCC during development because the generated output 444 files are not included in the version-controlled source repository. 445 They are included in releases. 446 </p> 447 </dd> 448 <dt>Texinfo version 4.7 (or later)</dt> 449 <dd> 450 <p>Necessary for running <code class="command">makeinfo</code> when modifying <samp class="file">*.texi</samp> 451 files to test your changes. 452 </p> 453 <p>Necessary for running <code class="command">make dvi</code>, <code class="command">make pdf</code>, 454 or <code class="command">make html</code> to create formatted documentation. Texinfo version 455 4.8 or later is required for <code class="command">make pdf</code>. 456 </p> 457 <p>Necessary to build GCC documentation in info format during development 458 because the generated output files are not included in the repository. 459 (They are included in release tarballs.) 460 </p> 461 <p>Note that the minimum requirement is for a very old version of 462 Texinfo, but recent versions of Texinfo produce better-quality output, 463 especially for HTML format. The version of Texinfo packaged with any 464 current operating system distribution is likely to be adequate for 465 building the documentation without error, but you may still want to 466 install a newer release to get the best appearance and usability of 467 the generated manuals. 468 </p> 469 </dd> 470 <dt>TeX (any working version)</dt> 471 <dd> 472 <p>Necessary for running <code class="command">texi2dvi</code> and <code class="command">texi2pdf</code>, which 473 are used when running <code class="command">make dvi</code> or <code class="command">make pdf</code> to create 474 DVI or PDF files, respectively. 475 </p> 476 </dd> 477 <dt>Sphinx version 1.0 (or later)</dt> 478 <dd> 479 <p>Necessary to regenerate <samp class="file">jit/docs/_build/texinfo</samp> from the <samp class="file">.rst</samp> 480 files in the directories below <samp class="file">jit/docs</samp>. 481 </p> 482 </dd> 483 <dt>git (any version)</dt> 484 <dt>SSH (any version)</dt> 485 <dd> 486 <p>Necessary to access the source repository. Public releases and weekly 487 snapshots of the development sources are also available via HTTPS. 488 </p> 489 </dd> 490 <dt>GNU diffutils version 2.7 (or later)</dt> 491 <dd> 492 <p>Useful when submitting patches for the GCC source code. 493 </p> 494 </dd> 495 <dt>patch version 2.5.4 (or later)</dt> 496 <dd> 497 <p>Necessary when applying patches, created with <code class="command">diff</code>, to one’s 498 own sources. 499 </p> 500 </dd> 501 </dl> 502 503 <hr /> 504 <p> 505 <p><a class="uref" href="./index.html">Return to the GCC Installation page</a> 506 </p> 507 508 509 510 511 512 513 514 515 516 517 518 519 </body> 520 </html> 521