Home | History | Annotate | Line # | Download | only in INSTALL
test.html revision 1.8
      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-2017 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.4, http://www.gnu.org/software/texinfo/ -->
     23 <head>
     24 <title>Installing GCC</title>
     25 
     26 <meta name="description" content="Installing GCC">
     27 <meta name="keywords" content="Installing GCC">
     28 <meta name="resource-type" content="document">
     29 <meta name="distribution" content="global">
     30 <meta name="Generator" content="makeinfo">
     31 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     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">Installing GCC</h1>
     65 
     66 
     67 
     68 
     69 
     70 
     71 
     72 
     73 
     74 
     75 
     76 
     77 
     78 
     79 
     80 
     81 
     82 
     83 
     84 
     85 
     86 <a name="index-Testing"></a>
     87 <a name="index-Installing-GCC_003a-Testing"></a>
     88 <a name="index-Testsuite"></a>
     89 
     90 <p>Before you install GCC, we encourage you to run the testsuites and to
     91 compare your results with results from a similar configuration that have
     92 been submitted to the
     93 <a href="http://gcc.gnu.org/ml/gcc-testresults/">gcc-testresults mailing list</a>.
     94 Some of these archived results are linked from the build status lists
     95 at <a href="http://gcc.gnu.org/buildstat.html">http://gcc.gnu.org/buildstat.html</a>, although not everyone who
     96 reports a successful build runs the testsuites and submits the results.
     97 This step is optional and may require you to download additional software,
     98 but it can give you confidence in your new GCC installation or point out
     99 problems before you install and start using your new GCC.
    100 </p>
    101 <p>First, you must have <a href="download.html">downloaded the testsuites</a>.
    102 These are part of the full distribution, but if you downloaded the
    103 &ldquo;core&rdquo; compiler plus any front ends, you must download the testsuites
    104 separately.
    105 </p>
    106 <p>Second, you must have the testing tools installed.  This includes
    107 <a href="http://www.gnu.org/software/dejagnu/">DejaGnu</a>, Tcl, and Expect;
    108 the DejaGnu site has links to these.
    109 </p>
    110 <p>If the directories where <code>runtest</code> and <code>expect</code> were
    111 installed are not in the <code>PATH</code>, you may need to set the following
    112 environment variables appropriately, as in the following example (which
    113 assumes that DejaGnu has been installed under <samp>/usr/local</samp>):
    114 </p>
    115 <div class="smallexample">
    116 <pre class="smallexample">TCL_LIBRARY = /usr/local/share/tcl8.0
    117 DEJAGNULIBS = /usr/local/share/dejagnu
    118 </pre></div>
    119 
    120 <p>(On systems such as Cygwin, these paths are required to be actual
    121 paths, not mounts or links; presumably this is due to some lack of
    122 portability in the DejaGnu code.)
    123 </p>
    124 
    125 <p>Finally, you can run the testsuite (which may take a long time):
    126 </p><div class="smallexample">
    127 <pre class="smallexample">cd <var>objdir</var>; make -k check
    128 </pre></div>
    129 
    130 <p>This will test various components of GCC, such as compiler
    131 front ends and runtime libraries.  While running the testsuite, DejaGnu
    132 might emit some harmless messages resembling
    133 &lsquo;<samp>WARNING: Couldn't find the global config file.</samp>&rsquo; or
    134 &lsquo;<samp>WARNING: Couldn't find tool init file</samp>&rsquo; that can be ignored.
    135 </p>
    136 <p>If you are testing a cross-compiler, you may want to run the testsuite
    137 on a simulator as described at <a href="http://gcc.gnu.org/simtest-howto.html">http://gcc.gnu.org/simtest-howto.html</a>.
    138 </p>
    139 <a name="How-can-you-run-the-testsuite-on-selected-tests_003f"></a>
    140 <h3 class="section">How can you run the testsuite on selected tests?</h3>
    141 
    142 <p>In order to run sets of tests selectively, there are targets
    143 &lsquo;<samp>make check-gcc</samp>&rsquo; and language specific &lsquo;<samp>make check-c</samp>&rsquo;,
    144 &lsquo;<samp>make check-c++</samp>&rsquo;, &lsquo;<samp>make check-fortran</samp>&rsquo;, &lsquo;<samp>make check-java</samp>&rsquo;,
    145 &lsquo;<samp>make check-ada</samp>&rsquo;, &lsquo;<samp>make check-objc</samp>&rsquo;, &lsquo;<samp>make check-obj-c++</samp>&rsquo;,
    146 &lsquo;<samp>make check-lto</samp>&rsquo;
    147 in the <samp>gcc</samp> subdirectory of the object directory.  You can also
    148 just run &lsquo;<samp>make check</samp>&rsquo; in a subdirectory of the object directory.
    149 </p>
    150 
    151 <p>A more selective way to just run all <code>gcc</code> execute tests in the
    152 testsuite is to use
    153 </p>
    154 <div class="smallexample">
    155 <pre class="smallexample">make check-gcc RUNTESTFLAGS=&quot;execute.exp <var>other-options</var>&quot;
    156 </pre></div>
    157 
    158 <p>Likewise, in order to run only the <code>g++</code> &ldquo;old-deja&rdquo; tests in
    159 the testsuite with filenames matching &lsquo;<samp>9805*</samp>&rsquo;, you would use
    160 </p>
    161 <div class="smallexample">
    162 <pre class="smallexample">make check-g++ RUNTESTFLAGS=&quot;old-deja.exp=9805* <var>other-options</var>&quot;
    163 </pre></div>
    164 
    165 <p>The <samp>*.exp</samp> files are located in the testsuite directories of the GCC
    166 source, the most important ones being <samp>compile.exp</samp>,
    167 <samp>execute.exp</samp>, <samp>dg.exp</samp> and <samp>old-deja.exp</samp>.
    168 To get a list of the possible <samp>*.exp</samp> files, pipe the
    169 output of &lsquo;<samp>make check</samp>&rsquo; into a file and look at the
    170 &lsquo;<samp>Running &hellip;  .exp</samp>&rsquo; lines.
    171 </p>
    172 <a name="Passing-options-and-running-multiple-testsuites"></a>
    173 <h3 class="section">Passing options and running multiple testsuites</h3>
    174 
    175 <p>You can pass multiple options to the testsuite using the
    176 &lsquo;<samp>--target_board</samp>&rsquo; option of DejaGNU, either passed as part of
    177 &lsquo;<samp>RUNTESTFLAGS</samp>&rsquo;, or directly to <code>runtest</code> if you prefer to
    178 work outside the makefiles.  For example,
    179 </p>
    180 <div class="smallexample">
    181 <pre class="smallexample">make check-g++ RUNTESTFLAGS=&quot;--target_board=unix/-O3/-fmerge-constants&quot;
    182 </pre></div>
    183 
    184 <p>will run the standard <code>g++</code> testsuites (&ldquo;unix&rdquo; is the target name
    185 for a standard native testsuite situation), passing
    186 &lsquo;<samp>-O3 -fmerge-constants</samp>&rsquo; to the compiler on every test, i.e.,
    187 slashes separate options.
    188 </p>
    189 <p>You can run the testsuites multiple times using combinations of options
    190 with a syntax similar to the brace expansion of popular shells:
    191 </p>
    192 <div class="smallexample">
    193 <pre class="smallexample">&hellip;&quot;--target_board=arm-sim\{-mhard-float,-msoft-float\}\{-O1,-O2,-O3,\}&quot;
    194 </pre></div>
    195 
    196 <p>(Note the empty option caused by the trailing comma in the final group.)
    197 The following will run each testsuite eight times using the &lsquo;<samp>arm-sim</samp>&rsquo;
    198 target, as if you had specified all possible combinations yourself:
    199 </p>
    200 <div class="smallexample">
    201 <pre class="smallexample">--target_board='arm-sim/-mhard-float/-O1 \
    202                 arm-sim/-mhard-float/-O2 \
    203                 arm-sim/-mhard-float/-O3 \
    204                 arm-sim/-mhard-float \
    205                 arm-sim/-msoft-float/-O1 \
    206                 arm-sim/-msoft-float/-O2 \
    207                 arm-sim/-msoft-float/-O3 \
    208                 arm-sim/-msoft-float'
    209 </pre></div>
    210 
    211 <p>They can be combined as many times as you wish, in arbitrary ways.  This
    212 list:
    213 </p>
    214 <div class="smallexample">
    215 <pre class="smallexample">&hellip;&quot;--target_board=unix/-Wextra\{-O3,-fno-strength\}\{-fomit-frame,\}&quot;
    216 </pre></div>
    217 
    218 <p>will generate four combinations, all involving &lsquo;<samp>-Wextra</samp>&rsquo;.
    219 </p>
    220 <p>The disadvantage to this method is that the testsuites are run in serial,
    221 which is a waste on multiprocessor systems.  For users with GNU Make and
    222 a shell which performs brace expansion, you can run the testsuites in
    223 parallel by having the shell perform the combinations and <code>make</code>
    224 do the parallel runs.  Instead of using &lsquo;<samp>--target_board</samp>&rsquo;, use a
    225 special makefile target:
    226 </p>
    227 <div class="smallexample">
    228 <pre class="smallexample">make -j<var>N</var> check-<var>testsuite</var>//<var>test-target</var>/<var>option1</var>/<var>option2</var>/&hellip;
    229 </pre></div>
    230 
    231 <p>For example,
    232 </p>
    233 <div class="smallexample">
    234 <pre class="smallexample">make -j3 check-gcc//sh-hms-sim/{-m1,-m2,-m3,-m3e,-m4}/{,-nofpu}
    235 </pre></div>
    236 
    237 <p>will run three concurrent &ldquo;make-gcc&rdquo; testsuites, eventually testing all
    238 ten combinations as described above.  Note that this is currently only
    239 supported in the <samp>gcc</samp> subdirectory.  (To see how this works, try
    240 typing <code>echo</code> before the example given here.)
    241 </p>
    242 
    243 <a name="Additional-testing-for-Java-Class-Libraries"></a>
    244 <h3 class="section">Additional testing for Java Class Libraries</h3>
    245 
    246 <p>The Java runtime tests can be executed via &lsquo;<samp>make check</samp>&rsquo;
    247 in the <samp><var>target</var>/libjava/testsuite</samp> directory in
    248 the build tree.
    249 </p>
    250 <p>The <a href="http://sourceware.org/mauve/">Mauve Project</a> provides
    251 a suite of tests for the Java Class Libraries.  This suite can be run
    252 as part of libgcj testing by placing the Mauve tree within the libjava
    253 testsuite at <samp>libjava/testsuite/libjava.mauve/mauve</samp>, or by
    254 specifying the location of that tree when invoking &lsquo;<samp>make</samp>&rsquo;, as in
    255 &lsquo;<samp>make MAUVEDIR=~/mauve check</samp>&rsquo;.
    256 </p>
    257 <a name="How-to-interpret-test-results"></a>
    258 <h3 class="section">How to interpret test results</h3>
    259 
    260 <p>The result of running the testsuite are various <samp>*.sum</samp> and <samp>*.log</samp>
    261 files in the testsuite subdirectories.  The <samp>*.log</samp> files contain a
    262 detailed log of the compiler invocations and the corresponding
    263 results, the <samp>*.sum</samp> files summarize the results.  These summaries
    264 contain status codes for all tests:
    265 </p>
    266 <ul>
    267 <li> PASS: the test passed as expected
    268 </li><li> XPASS: the test unexpectedly passed
    269 </li><li> FAIL: the test unexpectedly failed
    270 </li><li> XFAIL: the test failed as expected
    271 </li><li> UNSUPPORTED: the test is not supported on this platform
    272 </li><li> ERROR: the testsuite detected an error
    273 </li><li> WARNING: the testsuite detected a possible problem
    274 </li></ul>
    275 
    276 <p>It is normal for some tests to report unexpected failures.  At the
    277 current time the testing harness does not allow fine grained control
    278 over whether or not a test is expected to fail.  This problem should
    279 be fixed in future releases.
    280 </p>
    281 
    282 <a name="Submitting-test-results"></a>
    283 <h3 class="section">Submitting test results</h3>
    284 
    285 <p>If you want to report the results to the GCC project, use the
    286 <samp>contrib/test_summary</samp> shell script.  Start it in the <var>objdir</var> with
    287 </p>
    288 <div class="smallexample">
    289 <pre class="smallexample"><var>srcdir</var>/contrib/test_summary -p your_commentary.txt \
    290     -m gcc-testresults (a] gcc.gnu.org |sh
    291 </pre></div>
    292 
    293 <p>This script uses the <code>Mail</code> program to send the results, so
    294 make sure it is in your <code>PATH</code>.  The file <samp>your_commentary.txt</samp> is
    295 prepended to the testsuite summary and should contain any special
    296 remarks you have on your results or your build environment.  Please
    297 do not edit the testsuite result block or the subject line, as these
    298 messages may be automatically processed.
    299 </p>
    300 <hr />
    301 <p>
    302 <p><a href="./index.html">Return to the GCC Installation page</a>
    303 </p>
    304 
    305 
    306 
    307 
    308 
    309 
    310 <hr>
    311 
    312 
    313 
    314 </body>
    315 </html>
    316