Home | History | Annotate | Line # | Download | only in INSTALL
build.html revision 1.8
      1  1.8    mrg <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      2  1.8    mrg <html>
      3  1.8    mrg <!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.
      4  1.1    mrg 
      5  1.8    mrg Permission is granted to copy, distribute and/or modify this document
      6  1.3  skrll under the terms of the GNU Free Documentation License, Version 1.3 or
      7  1.1    mrg any later version published by the Free Software Foundation; with no
      8  1.1    mrg Invariant Sections, the Front-Cover texts being (a) (see below), and
      9  1.1    mrg with the Back-Cover Texts being (b) (see below).  A copy of the
     10  1.8    mrg license is included in the section entitled "GNU
     11  1.8    mrg Free Documentation License".
     12  1.1    mrg 
     13  1.1    mrg (a) The FSF's Front-Cover Text is:
     14  1.1    mrg 
     15  1.8    mrg A GNU Manual
     16  1.1    mrg 
     17  1.1    mrg (b) The FSF's Back-Cover Text is:
     18  1.1    mrg 
     19  1.8    mrg You have freedom to copy and modify this GNU Manual, like GNU
     20  1.1    mrg      software.  Copies published by the Free Software Foundation raise
     21  1.8    mrg      funds for GNU development. -->
     22  1.8    mrg <!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
     23  1.8    mrg <head>
     24  1.8    mrg <title>Installing GCC</title>
     25  1.8    mrg 
     26  1.8    mrg <meta name="description" content="Installing GCC">
     27  1.8    mrg <meta name="keywords" content="Installing GCC">
     28  1.8    mrg <meta name="resource-type" content="document">
     29  1.8    mrg <meta name="distribution" content="global">
     30  1.8    mrg <meta name="Generator" content="makeinfo">
     31  1.8    mrg <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     32  1.8    mrg <style type="text/css">
     33  1.8    mrg <!--
     34  1.8    mrg a.summary-letter {text-decoration: none}
     35  1.8    mrg blockquote.indentedblock {margin-right: 0em}
     36  1.8    mrg blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
     37  1.8    mrg blockquote.smallquotation {font-size: smaller}
     38  1.8    mrg div.display {margin-left: 3.2em}
     39  1.8    mrg div.example {margin-left: 3.2em}
     40  1.8    mrg div.lisp {margin-left: 3.2em}
     41  1.8    mrg div.smalldisplay {margin-left: 3.2em}
     42  1.8    mrg div.smallexample {margin-left: 3.2em}
     43  1.8    mrg div.smalllisp {margin-left: 3.2em}
     44  1.8    mrg kbd {font-style: oblique}
     45  1.8    mrg pre.display {font-family: inherit}
     46  1.8    mrg pre.format {font-family: inherit}
     47  1.8    mrg pre.menu-comment {font-family: serif}
     48  1.8    mrg pre.menu-preformatted {font-family: serif}
     49  1.8    mrg pre.smalldisplay {font-family: inherit; font-size: smaller}
     50  1.8    mrg pre.smallexample {font-size: smaller}
     51  1.8    mrg pre.smallformat {font-family: inherit; font-size: smaller}
     52  1.8    mrg pre.smalllisp {font-size: smaller}
     53  1.8    mrg span.nolinebreak {white-space: nowrap}
     54  1.8    mrg span.roman {font-family: initial; font-weight: normal}
     55  1.8    mrg span.sansserif {font-family: sans-serif; font-weight: normal}
     56  1.8    mrg ul.no-bullet {list-style: none}
     57  1.8    mrg -->
     58  1.8    mrg </style>
     59  1.8    mrg 
     60  1.8    mrg 
     61  1.1    mrg </head>
     62  1.8    mrg 
     63  1.8    mrg <body lang="en">
     64  1.8    mrg <h1 class="settitle" align="center">Installing GCC</h1>
     65  1.8    mrg 
     66  1.8    mrg 
     67  1.8    mrg 
     68  1.8    mrg 
     69  1.8    mrg 
     70  1.8    mrg 
     71  1.8    mrg 
     72  1.8    mrg 
     73  1.8    mrg 
     74  1.8    mrg 
     75  1.8    mrg 
     76  1.8    mrg 
     77  1.8    mrg 
     78  1.8    mrg 
     79  1.8    mrg 
     80  1.8    mrg 
     81  1.8    mrg 
     82  1.8    mrg 
     83  1.8    mrg 
     84  1.8    mrg 
     85  1.8    mrg <a name="index-Installing-GCC_003a-Building"></a>
     86  1.8    mrg 
     87  1.8    mrg <p>Now that GCC is configured, you are ready to build the compiler and
     88  1.7    mrg runtime libraries.
     89  1.8    mrg </p>
     90  1.8    mrg <p>Some commands executed when making the compiler may fail (return a
     91  1.8    mrg nonzero status) and be ignored by <code>make</code>.  These failures, which
     92  1.1    mrg are often due to files that were not found, are expected, and can safely
     93  1.1    mrg be ignored.
     94  1.8    mrg </p>
     95  1.8    mrg <p>It is normal to have compiler warnings when compiling certain files.
     96  1.1    mrg Unless you are a GCC developer, you can generally ignore these warnings
     97  1.1    mrg unless they cause compilation to fail.  Developers should attempt to fix
     98  1.1    mrg any warnings encountered, however they can temporarily continue past
     99  1.1    mrg warnings-as-errors by specifying the configure flag
    100  1.8    mrg <samp>--disable-werror</samp>.
    101  1.8    mrg </p>
    102  1.8    mrg <p>On certain old systems, defining certain environment variables such as
    103  1.8    mrg <code>CC</code> can interfere with the functioning of <code>make</code>.
    104  1.8    mrg </p>
    105  1.8    mrg <p>If you encounter seemingly strange errors when trying to build the
    106  1.1    mrg compiler in a directory other than the source directory, it could be
    107  1.1    mrg because you have previously configured the compiler in the source
    108  1.1    mrg directory.  Make sure you have done all the necessary preparations.
    109  1.8    mrg </p>
    110  1.8    mrg <p>If you build GCC on a BSD system using a directory stored in an old System
    111  1.8    mrg V file system, problems may occur in running <code>fixincludes</code> if the
    112  1.8    mrg System V file system doesn&rsquo;t support symbolic links.  These problems
    113  1.1    mrg result in a failure to fix the declaration of <code>size_t</code> in
    114  1.8    mrg <samp>sys/types.h</samp>.  If you find that <code>size_t</code> is a signed type and
    115  1.1    mrg that type mismatches occur, this could be the cause.
    116  1.8    mrg </p>
    117  1.8    mrg <p>The solution is not to use such a directory for building GCC.
    118  1.8    mrg </p>
    119  1.8    mrg <p>Similarly, when building from SVN or snapshots, or if you modify
    120  1.8    mrg <samp>*.l</samp> files, you need the Flex lexical analyzer generator
    121  1.8    mrg installed.  If you do not modify <samp>*.l</samp> files, releases contain
    122  1.1    mrg the Flex-generated files and you do not need Flex installed to build
    123  1.1    mrg them.  There is still one Flex-based lexical analyzer (part of the
    124  1.1    mrg build machinery, not of GCC itself) that is used even if you only
    125  1.1    mrg build the C front end.
    126  1.8    mrg </p>
    127  1.8    mrg <p>When building from SVN or snapshots, or if you modify Texinfo
    128  1.1    mrg documentation, you need version 4.7 or later of Texinfo installed if you
    129  1.1    mrg want Info documentation to be regenerated.  Releases contain Info
    130  1.1    mrg documentation pre-built for the unmodified documentation in the release.
    131  1.8    mrg </p>
    132  1.8    mrg <a name="Building-a-native-compiler"></a>
    133  1.8    mrg <h3 class="section">Building a native compiler</h3>
    134  1.1    mrg 
    135  1.1    mrg <p>For a native build, the default configuration is to perform
    136  1.8    mrg a 3-stage bootstrap of the compiler when &lsquo;<samp>make</samp>&rsquo; is invoked.
    137  1.1    mrg This will build the entire GCC system and ensure that it compiles
    138  1.8    mrg itself correctly.  It can be disabled with the <samp>--disable-bootstrap</samp>
    139  1.8    mrg parameter to &lsquo;<samp>configure</samp>&rsquo;, but bootstrapping is suggested because
    140  1.1    mrg the compiler will be tested more completely and could also have
    141  1.1    mrg better performance.
    142  1.8    mrg </p>
    143  1.8    mrg <p>The bootstrapping process will complete the following steps:
    144  1.8    mrg </p>
    145  1.8    mrg <ul>
    146  1.8    mrg <li> Build tools necessary to build the compiler.
    147  1.1    mrg 
    148  1.8    mrg </li><li> Perform a 3-stage bootstrap of the compiler.  This includes building
    149  1.1    mrg three times the target tools for use by the compiler such as binutils
    150  1.1    mrg (bfd, binutils, gas, gprof, ld, and opcodes) if they have been
    151  1.1    mrg individually linked or moved into the top level GCC source tree before
    152  1.1    mrg configuring.
    153  1.1    mrg 
    154  1.8    mrg </li><li> Perform a comparison test of the stage2 and stage3 compilers.
    155  1.1    mrg 
    156  1.8    mrg </li><li> Build runtime libraries using the stage3 compiler from the previous step.
    157  1.1    mrg 
    158  1.8    mrg </li></ul>
    159  1.1    mrg 
    160  1.8    mrg <p>If you are short on disk space you might consider &lsquo;<samp>make
    161  1.8    mrg bootstrap-lean</samp>&rsquo; instead.  The sequence of compilation is the
    162  1.1    mrg same described above, but object files from the stage1 and
    163  1.1    mrg stage2 of the 3-stage bootstrap of the compiler are deleted as
    164  1.1    mrg soon as they are no longer needed.
    165  1.8    mrg </p>
    166  1.8    mrg <p>If you wish to use non-default GCC flags when compiling the stage2
    167  1.1    mrg and stage3 compilers, set <code>BOOT_CFLAGS</code> on the command line when
    168  1.8    mrg doing &lsquo;<samp>make</samp>&rsquo;.  For example, if you want to save additional space
    169  1.1    mrg during the bootstrap and in the final installation as well, you can
    170  1.1    mrg build the compiler binaries without debugging information as in the
    171  1.1    mrg following example.  This will save roughly 40% of disk space both for
    172  1.1    mrg the bootstrap and the final installation.  (Libraries will still contain
    173  1.1    mrg debugging information.)
    174  1.8    mrg </p>
    175  1.8    mrg <div class="smallexample">
    176  1.8    mrg <pre class="smallexample">make BOOT_CFLAGS='-O' bootstrap
    177  1.8    mrg </pre></div>
    178  1.1    mrg 
    179  1.8    mrg <p>You can place non-default optimization flags into <code>BOOT_CFLAGS</code>; they
    180  1.8    mrg are less well tested here than the default of &lsquo;<samp>-g -O2</samp>&rsquo;, but should
    181  1.1    mrg still work.  In a few cases, you may find that you need to specify special
    182  1.8    mrg flags such as <samp>-msoft-float</samp> here to complete the bootstrap; or,
    183  1.1    mrg if the native compiler miscompiles the stage1 compiler, you may need
    184  1.1    mrg to work around this, by choosing <code>BOOT_CFLAGS</code> to avoid the parts
    185  1.8    mrg of the stage1 compiler that were miscompiled, or by using &lsquo;<samp>make
    186  1.8    mrg bootstrap4</samp>&rsquo; to increase the number of stages of bootstrap.
    187  1.8    mrg </p>
    188  1.8    mrg <p><code>BOOT_CFLAGS</code> does not apply to bootstrapped target libraries.
    189  1.1    mrg Since these are always compiled with the compiler currently being
    190  1.1    mrg bootstrapped, you can use <code>CFLAGS_FOR_TARGET</code> to modify their
    191  1.8    mrg compilation flags, as for non-bootstrapped target libraries.
    192  1.1    mrg Again, if the native compiler miscompiles the stage1 compiler, you may
    193  1.1    mrg need to work around this by avoiding non-working parts of the stage1
    194  1.1    mrg compiler.  Use <code>STAGE1_TFLAGS</code> to this end.
    195  1.8    mrg </p>
    196  1.8    mrg <p>If you used the flag <samp>--enable-languages=&hellip;</samp> to restrict
    197  1.8    mrg the compilers to be built, only those you&rsquo;ve actually enabled will be
    198  1.1    mrg built.  This will of course only build those runtime libraries, for
    199  1.1    mrg which the particular compiler has been built.  Please note,
    200  1.8    mrg that re-defining <code>LANGUAGES</code> when calling &lsquo;<samp>make</samp>&rsquo;
    201  1.1    mrg <strong>does not</strong> work anymore!
    202  1.8    mrg </p>
    203  1.8    mrg <p>If the comparison of stage2 and stage3 fails, this normally indicates
    204  1.1    mrg that the stage2 compiler has compiled GCC incorrectly, and is therefore
    205  1.1    mrg a potentially serious bug which you should investigate and report.  (On
    206  1.1    mrg a few systems, meaningful comparison of object files is impossible; they
    207  1.1    mrg always appear &ldquo;different&rdquo;.  If you encounter this problem, you will
    208  1.8    mrg need to disable comparison in the <samp>Makefile</samp>.)
    209  1.8    mrg </p>
    210  1.8    mrg <p>If you do not want to bootstrap your compiler, you can configure with
    211  1.8    mrg <samp>--disable-bootstrap</samp>.  In particular cases, you may want to
    212  1.1    mrg bootstrap your compiler even if the target system is not the same as
    213  1.1    mrg the one you are building on: for example, you could build a
    214  1.1    mrg <code>powerpc-unknown-linux-gnu</code> toolchain on a
    215  1.1    mrg <code>powerpc64-unknown-linux-gnu</code> host.  In this case, pass
    216  1.8    mrg <samp>--enable-bootstrap</samp> to the configure script.
    217  1.8    mrg </p>
    218  1.8    mrg <p><code>BUILD_CONFIG</code> can be used to bring in additional customization
    219  1.8    mrg to the build.  It can be set to a whitespace-separated list of names.
    220  1.8    mrg For each such <code>NAME</code>, top-level <samp>config/<code>NAME</code>.mk</samp> will
    221  1.8    mrg be included by the top-level <samp>Makefile</samp>, bringing in any settings
    222  1.1    mrg it contains.  The default <code>BUILD_CONFIG</code> can be set using the
    223  1.8    mrg configure option <samp>--with-build-config=<code>NAME</code>...</samp>.  Some
    224  1.1    mrg examples of supported build configurations are:
    225  1.8    mrg </p>
    226  1.8    mrg <dl compact="compact">
    227  1.8    mrg <dt>&lsquo;<samp>bootstrap-O1</samp>&rsquo;</dt>
    228  1.8    mrg <dd><p>Removes any <samp>-O</samp>-started option from <code>BOOT_CFLAGS</code>, and adds
    229  1.8    mrg <samp>-O1</samp> to it.  &lsquo;<samp>BUILD_CONFIG=bootstrap-O1</samp>&rsquo; is equivalent to
    230  1.8    mrg &lsquo;<samp>BOOT_CFLAGS='-g -O1'</samp>&rsquo;.
    231  1.8    mrg </p>
    232  1.8    mrg </dd>
    233  1.8    mrg <dt>&lsquo;<samp>bootstrap-O3</samp>&rsquo;</dt>
    234  1.8    mrg <dd><p>Analogous to <code>bootstrap-O1</code>.
    235  1.8    mrg </p>
    236  1.8    mrg </dd>
    237  1.8    mrg <dt>&lsquo;<samp>bootstrap-lto</samp>&rsquo;</dt>
    238  1.8    mrg <dd><p>Enables Link-Time Optimization for host tools during bootstrapping.
    239  1.8    mrg &lsquo;<samp>BUILD_CONFIG=bootstrap-lto</samp>&rsquo; is equivalent to adding
    240  1.8    mrg <samp>-flto</samp> to &lsquo;<samp>BOOT_CFLAGS</samp>&rsquo;.  This option assumes that the host
    241  1.5    mrg supports the linker plugin (e.g. GNU ld version 2.21 or later or GNU gold
    242  1.5    mrg version 2.21 or later).
    243  1.8    mrg </p>
    244  1.8    mrg </dd>
    245  1.8    mrg <dt>&lsquo;<samp>bootstrap-lto-noplugin</samp>&rsquo;</dt>
    246  1.8    mrg <dd><p>This option is similar to <code>bootstrap-lto</code>, but is intended for
    247  1.8    mrg hosts that do not support the linker plugin.  Without the linker plugin 
    248  1.8    mrg static libraries are not compiled with link-time optimizations.  Since 
    249  1.8    mrg the GCC middle end and back end are in <samp>libbackend.a</samp> this means
    250  1.5    mrg that only the front end is actually LTO optimized.
    251  1.8    mrg </p>
    252  1.8    mrg </dd>
    253  1.8    mrg <dt>&lsquo;<samp>bootstrap-debug</samp>&rsquo;</dt>
    254  1.8    mrg <dd><p>Verifies that the compiler generates the same executable code, whether
    255  1.1    mrg or not it is asked to emit debug information.  To this end, this
    256  1.1    mrg option builds stage2 host programs without debug information, and uses
    257  1.8    mrg <samp>contrib/compare-debug</samp> to compare them with the stripped stage3
    258  1.1    mrg object files.  If <code>BOOT_CFLAGS</code> is overridden so as to not enable
    259  1.8    mrg debug information, stage2 will have it, and stage3 won&rsquo;t.  This option
    260  1.1    mrg is enabled by default when GCC bootstrapping is enabled, if
    261  1.1    mrg <code>strip</code> can turn object files compiled with and without debug
    262  1.1    mrg info into identical object files.  In addition to better test
    263  1.1    mrg coverage, this option makes default bootstraps faster and leaner.
    264  1.8    mrg </p>
    265  1.8    mrg </dd>
    266  1.8    mrg <dt>&lsquo;<samp>bootstrap-debug-big</samp>&rsquo;</dt>
    267  1.8    mrg <dd><p>Rather than comparing stripped object files, as in
    268  1.1    mrg <code>bootstrap-debug</code>, this option saves internal compiler dumps
    269  1.1    mrg during stage2 and stage3 and compares them as well, which helps catch
    270  1.1    mrg additional potential problems, but at a great cost in terms of disk
    271  1.8    mrg space.  It can be specified in addition to &lsquo;<samp>bootstrap-debug</samp>&rsquo;.
    272  1.8    mrg </p>
    273  1.8    mrg </dd>
    274  1.8    mrg <dt>&lsquo;<samp>bootstrap-debug-lean</samp>&rsquo;</dt>
    275  1.8    mrg <dd><p>This option saves disk space compared with <code>bootstrap-debug-big</code>,
    276  1.1    mrg but at the expense of some recompilation.  Instead of saving the dumps
    277  1.1    mrg of stage2 and stage3 until the final compare, it uses
    278  1.8    mrg <samp>-fcompare-debug</samp> to generate, compare and remove the dumps
    279  1.1    mrg during stage3, repeating the compilation that already took place in
    280  1.1    mrg stage2, whose dumps were not saved.
    281  1.8    mrg </p>
    282  1.8    mrg </dd>
    283  1.8    mrg <dt>&lsquo;<samp>bootstrap-debug-lib</samp>&rsquo;</dt>
    284  1.8    mrg <dd><p>This option tests executable code invariance over debug information
    285  1.1    mrg generation on target libraries, just like <code>bootstrap-debug-lean</code>
    286  1.1    mrg tests it on host programs.  It builds stage3 libraries with
    287  1.8    mrg <samp>-fcompare-debug</samp>, and it can be used along with any of the
    288  1.1    mrg <code>bootstrap-debug</code> options above.
    289  1.8    mrg </p>
    290  1.8    mrg <p>There aren&rsquo;t <code>-lean</code> or <code>-big</code> counterparts to this option
    291  1.1    mrg because most libraries are only build in stage3, so bootstrap compares
    292  1.1    mrg would not get significant coverage.  Moreover, the few libraries built
    293  1.8    mrg in stage2 are used in stage3 host programs, so we wouldn&rsquo;t want to
    294  1.1    mrg compile stage2 libraries with different options for comparison purposes.
    295  1.8    mrg </p>
    296  1.8    mrg </dd>
    297  1.8    mrg <dt>&lsquo;<samp>bootstrap-debug-ckovw</samp>&rsquo;</dt>
    298  1.8    mrg <dd><p>Arranges for error messages to be issued if the compiler built on any
    299  1.8    mrg stage is run without the option <samp>-fcompare-debug</samp>.  This is
    300  1.8    mrg useful to verify the full <samp>-fcompare-debug</samp> testing coverage.  It
    301  1.1    mrg must be used along with <code>bootstrap-debug-lean</code> and
    302  1.1    mrg <code>bootstrap-debug-lib</code>.
    303  1.8    mrg </p>
    304  1.8    mrg </dd>
    305  1.8    mrg <dt>&lsquo;<samp>bootstrap-time</samp>&rsquo;</dt>
    306  1.8    mrg <dd><p>Arranges for the run time of each program started by the GCC driver,
    307  1.8    mrg built in any stage, to be logged to <samp>time.log</samp>, in the top level of
    308  1.1    mrg the build tree.
    309  1.8    mrg </p>
    310  1.8    mrg </dd>
    311  1.8    mrg </dl>
    312  1.1    mrg 
    313  1.8    mrg <a name="Building-a-cross-compiler"></a>
    314  1.8    mrg <h3 class="section">Building a cross compiler</h3>
    315  1.1    mrg 
    316  1.1    mrg <p>When building a cross compiler, it is not generally possible to do a
    317  1.1    mrg 3-stage bootstrap of the compiler.  This makes for an interesting problem
    318  1.1    mrg as parts of GCC can only be built with GCC.
    319  1.8    mrg </p>
    320  1.8    mrg <p>To build a cross compiler, we recommend first building and installing a
    321  1.1    mrg native compiler.  You can then use the native GCC compiler to build the
    322  1.1    mrg cross compiler.  The installed native compiler needs to be GCC version
    323  1.1    mrg 2.95 or later.
    324  1.8    mrg </p>
    325  1.8    mrg <p>If the cross compiler is to be built with support for the Java
    326  1.1    mrg programming language and the ability to compile .java source files is
    327  1.1    mrg desired, the installed native compiler used to build the cross
    328  1.1    mrg compiler needs to be the same GCC version as the cross compiler.  In
    329  1.1    mrg addition the cross compiler needs to be configured with
    330  1.8    mrg <samp>--with-ecj-jar=&hellip;</samp>.
    331  1.8    mrg </p>
    332  1.8    mrg <p>Assuming you have already installed a native copy of GCC and configured
    333  1.8    mrg your cross compiler, issue the command <code>make</code>, which performs the
    334  1.1    mrg following steps:
    335  1.8    mrg </p>
    336  1.8    mrg <ul>
    337  1.8    mrg <li> Build host tools necessary to build the compiler.
    338  1.1    mrg 
    339  1.8    mrg </li><li> Build target tools for use by the compiler such as binutils (bfd,
    340  1.1    mrg binutils, gas, gprof, ld, and opcodes)
    341  1.1    mrg if they have been individually linked or moved into the top level GCC source
    342  1.1    mrg tree before configuring.
    343  1.1    mrg 
    344  1.8    mrg </li><li> Build the compiler (single stage only).
    345  1.1    mrg 
    346  1.8    mrg </li><li> Build runtime libraries using the compiler from the previous step.
    347  1.8    mrg </li></ul>
    348  1.1    mrg 
    349  1.8    mrg <p>Note that if an error occurs in any step the make process will exit.
    350  1.8    mrg </p>
    351  1.8    mrg <p>If you are not building GNU binutils in the same source tree as GCC,
    352  1.1    mrg you will need a cross-assembler and cross-linker installed before
    353  1.1    mrg configuring GCC.  Put them in the directory
    354  1.8    mrg <samp><var>prefix</var>/<var>target</var>/bin</samp>.  Here is a table of the tools
    355  1.1    mrg you should put in this directory:
    356  1.8    mrg </p>
    357  1.8    mrg <dl compact="compact">
    358  1.8    mrg <dt><samp>as</samp></dt>
    359  1.8    mrg <dd><p>This should be the cross-assembler.
    360  1.8    mrg </p>
    361  1.8    mrg </dd>
    362  1.8    mrg <dt><samp>ld</samp></dt>
    363  1.8    mrg <dd><p>This should be the cross-linker.
    364  1.8    mrg </p>
    365  1.8    mrg </dd>
    366  1.8    mrg <dt><samp>ar</samp></dt>
    367  1.8    mrg <dd><p>This should be the cross-archiver: a program which can manipulate
    368  1.8    mrg archive files (linker libraries) in the target machine&rsquo;s format.
    369  1.8    mrg </p>
    370  1.8    mrg </dd>
    371  1.8    mrg <dt><samp>ranlib</samp></dt>
    372  1.8    mrg <dd><p>This should be a program to construct a symbol table in an archive file.
    373  1.8    mrg </p></dd>
    374  1.1    mrg </dl>
    375  1.1    mrg 
    376  1.8    mrg <p>The installation of GCC will find these programs in that directory,
    377  1.1    mrg and copy or link them to the proper place to for the cross-compiler to
    378  1.1    mrg find them when run later.
    379  1.8    mrg </p>
    380  1.8    mrg <p>The easiest way to provide these files is to build the Binutils package.
    381  1.8    mrg Configure it with the same <samp>--host</samp> and <samp>--target</samp>
    382  1.1    mrg options that you use for configuring GCC, then build and install
    383  1.1    mrg them.  They install their executables automatically into the proper
    384  1.1    mrg directory.  Alas, they do not support all the targets that GCC
    385  1.1    mrg supports.
    386  1.8    mrg </p>
    387  1.8    mrg <p>If you are not building a C library in the same source tree as GCC,
    388  1.1    mrg you should also provide the target libraries and headers before
    389  1.1    mrg configuring GCC, specifying the directories with
    390  1.8    mrg <samp>--with-sysroot</samp> or <samp>--with-headers</samp> and
    391  1.8    mrg <samp>--with-libs</samp>.  Many targets also require &ldquo;start files&rdquo; such
    392  1.8    mrg as <samp>crt0.o</samp> and
    393  1.8    mrg <samp>crtn.o</samp> which are linked into each executable.  There may be several
    394  1.8    mrg alternatives for <samp>crt0.o</samp>, for use with profiling or other
    395  1.8    mrg compilation options.  Check your target&rsquo;s definition of
    396  1.1    mrg <code>STARTFILE_SPEC</code> to find out what start files it uses.
    397  1.8    mrg </p>
    398  1.8    mrg <a name="Building-in-parallel"></a>
    399  1.8    mrg <h3 class="section">Building in parallel</h3>
    400  1.1    mrg 
    401  1.1    mrg <p>GNU Make 3.80 and above, which is necessary to build GCC, support
    402  1.8    mrg building in parallel.  To activate this, you can use &lsquo;<samp>make -j 2</samp>&rsquo;
    403  1.8    mrg instead of &lsquo;<samp>make</samp>&rsquo;.  You can also specify a bigger number, and
    404  1.1    mrg in most cases using a value greater than the number of processors in
    405  1.1    mrg your machine will result in fewer and shorter I/O latency hits, thus
    406  1.1    mrg improving overall throughput; this is especially true for slow drives
    407  1.1    mrg and network filesystems.
    408  1.8    mrg </p>
    409  1.8    mrg <a name="Building-the-Ada-compiler"></a>
    410  1.8    mrg <h3 class="section">Building the Ada compiler</h3>
    411  1.1    mrg 
    412  1.1    mrg <p>In order to build GNAT, the Ada compiler, you need a working GNAT
    413  1.8    mrg compiler (GCC version 4.0 or later).
    414  1.8    mrg This includes GNAT tools such as <code>gnatmake</code> and
    415  1.8    mrg <code>gnatlink</code>, since the Ada front end is written in Ada and
    416  1.1    mrg uses some GNAT-specific extensions.
    417  1.8    mrg </p>
    418  1.8    mrg <p>In order to build a cross compiler, it is suggested to install
    419  1.1    mrg the new compiler as native first, and then use it to build the cross
    420  1.1    mrg compiler.
    421  1.8    mrg </p>
    422  1.8    mrg <p><code>configure</code> does not test whether the GNAT installation works
    423  1.1    mrg and has a sufficiently recent version; if too old a GNAT version is
    424  1.8    mrg installed, the build will fail unless <samp>--enable-languages</samp> is
    425  1.1    mrg used to disable building the Ada front end.
    426  1.8    mrg </p>
    427  1.8    mrg <p><code>ADA_INCLUDE_PATH</code> and <code>ADA_OBJECT_PATH</code> environment variables
    428  1.1    mrg must not be set when building the Ada compiler, the Ada tools, or the
    429  1.1    mrg Ada runtime libraries. You can check that your build environment is clean
    430  1.8    mrg by verifying that &lsquo;<samp>gnatls -v</samp>&rsquo; lists only one explicit path in each
    431  1.1    mrg section.
    432  1.8    mrg </p>
    433  1.8    mrg <a name="Building-with-profile-feedback"></a>
    434  1.8    mrg <h3 class="section">Building with profile feedback</h3>
    435  1.1    mrg 
    436  1.1    mrg <p>It is possible to use profile feedback to optimize the compiler itself.  This
    437  1.1    mrg should result in a faster compiler binary.  Experiments done on x86 using gcc
    438  1.1    mrg 3.3 showed approximately 7 percent speedup on compiling C programs.  To
    439  1.1    mrg bootstrap the compiler with profile feedback, use <code>make profiledbootstrap</code>.
    440  1.8    mrg </p>
    441  1.8    mrg <p>When &lsquo;<samp>make profiledbootstrap</samp>&rsquo; is run, it will first build a <code>stage1</code>
    442  1.1    mrg compiler.  This compiler is used to build a <code>stageprofile</code> compiler
    443  1.1    mrg instrumented to collect execution counts of instruction and branch
    444  1.8    mrg probabilities.  Then runtime libraries are compiled with profile collected.
    445  1.1    mrg Finally a <code>stagefeedback</code> compiler is built using the information collected.
    446  1.8    mrg </p>
    447  1.8    mrg <p>Unlike standard bootstrap, several additional restrictions apply.  The
    448  1.8    mrg compiler used to build <code>stage1</code> needs to support a 64-bit integral type.
    449  1.8    mrg It is recommended to only use GCC for this.
    450  1.8    mrg </p>
    451  1.8    mrg <hr />
    452  1.8    mrg <p>
    453  1.8    mrg <p><a href="./index.html">Return to the GCC Installation page</a>
    454  1.8    mrg </p>
    455  1.8    mrg 
    456  1.8    mrg 
    457  1.8    mrg 
    458  1.7    mrg 
    459  1.7    mrg 
    460  1.6    mrg 
    461  1.6    mrg 
    462  1.8    mrg <hr>
    463  1.8    mrg 
    464  1.8    mrg 
    465  1.8    mrg 
    466  1.8    mrg </body>
    467  1.8    mrg </html>
    468