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