You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

427 line
15KB

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