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