source: chapter06/gcc.xml@ 040ecb6

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 7.10 7.10-rc1 7.9 7.9-rc1 7.9-rc2 8.0 8.0-rc1 8.1 8.1-rc1 8.1-rc2 8.2 8.2-rc1 8.3 8.3-rc1 8.3-rc2 8.4 8.4-rc1 9.0 9.0-rc1 9.1 9.1-rc1 BOOK.old cross-chap5 ml-11.0 multilib nosym old-trunk trunk xry111/git-transition xry111/glibc-2.34 xry111/tester-nohack xry111/usr-move
Last change on this file since 040ecb6 was 040ecb6, checked in by Bruce Dubbs <bdubbs@…>, 6 years ago

Update to man-db-2.7.4.
Update to linux-4.2.3.
Update to tzdata2015g.
Many updates to installed files and directories. Huge thanks to Fernando.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10964 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 19.0 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-system-gcc" role="wrap">
9 <?dbhtml filename="gcc.html"?>
10
11 <sect1info condition="script">
12 <productname>gcc</productname>
13 <productnumber>&gcc-version;</productnumber>
14 <address>&gcc-url;</address>
15 </sect1info>
16
17 <title>GCC-&gcc-version;</title>
18
19 <indexterm zone="ch-system-gcc">
20 <primary sortas="a-GCC">GCC</primary>
21 </indexterm>
22
23 <sect2 role="package">
24 <title/>
25
26 <para>The GCC package contains the GNU compiler collection, which includes
27 the C and C++ compilers.</para>
28
29 <segmentedlist>
30 <segtitle>&buildtime;</segtitle>
31 <segtitle>&diskspace;</segtitle>
32
33 <seglistitem>
34 <seg>&gcc-ch6-sbu;</seg>
35 <seg>&gcc-ch6-du;</seg>
36 </seglistitem>
37 </segmentedlist>
38
39 </sect2>
40
41 <sect2 role="installation">
42 <title>Installation of GCC</title>
43<!--
44 <para>First apply some fixes from the upstream repository:</para>
45
46<screen><userinput remap="pre">patch -Np1 -i ../&gcc-upstream-patch;</userinput></screen>
47-->
48 <para>The GCC documentation recommends building GCC outside of the source
49 directory in a dedicated build directory:</para>
50
51<screen><userinput remap="pre">mkdir -v ../gcc-build
52cd ../gcc-build</userinput></screen>
53
54 <para>Prepare GCC for compilation:</para>
55
56<screen><userinput remap="configure">SED=sed \
57../gcc-&gcc-version;/configure \
58 --prefix=/usr \
59 --enable-languages=c,c++ \
60 --disable-multilib \
61 --disable-bootstrap \
62 --with-system-zlib</userinput></screen>
63
64 <para>Note that for other languages, there are some prerequisites that
65 are not yet available. See the
66 <ulink url="&blfs-book;general/gcc.html">BLFS Book</ulink>
67 for instructions on how to build all of GCC's supported languages.</para>
68
69 <variablelist>
70 <title>The meaning of the new configure option:</title>
71
72 <varlistentry>
73 <term><envar>SED=sed</envar></term>
74 <listitem>
75 <para>Setting this environment variable prevents a hard-coded
76 path to /tools/bin/sed.</para>
77 </listitem>
78 </varlistentry>
79
80 <varlistentry>
81 <term><parameter>--with-system-zlib</parameter></term>
82 <listitem>
83 <para>This switch tells GCC to link to the system installed copy of
84 the Zlib library, rather than its own internal copy.</para>
85 </listitem>
86 </varlistentry>
87 </variablelist>
88
89 <para>Compile the package:</para>
90
91<screen><userinput remap="make">make</userinput></screen>
92
93 <important>
94 <para>In this section, the test suite for GCC is considered
95 critical. Do not skip it under any circumstance.</para>
96 </important>
97
98 <para>One set of tests in the GCC test suite is known to exhaust the stack,
99 so increase the stack size prior to running the tests:</para>
100
101<screen><userinput remap="test">ulimit -s 32768</userinput></screen>
102
103 <para>Test the results, but do not stop at errors:</para>
104
105<screen><userinput remap="test">make -k check</userinput></screen>
106
107 <para>To receive a summary of the test suite results, run:</para>
108
109<screen><userinput remap="test">../gcc-&gcc-version;/contrib/test_summary</userinput></screen>
110
111 <para>For only the summaries, pipe the output through
112 <userinput>grep -A7 Summ</userinput>.</para>
113
114 <para>Results can be compared with those located at <ulink
115 url="&test-results;"/> and <ulink url="http://gcc.gnu.org/ml/gcc-testresults/"/>.</para>
116
117 <para>A few unexpected failures cannot always be avoided. The GCC developers
118 are usually aware of these issues, but have not resolved them yet.
119 In particular, one test in the libgomp test suite is known to fail.
120 Unless the test results are vastly different from those at the above URL,
121 it is safe to continue.</para>
122
123 <para>Install the package:</para>
124
125<screen><userinput remap="install">make install</userinput></screen>
126
127 <para>Some packages expect the C preprocessor to be installed in the
128 <filename class="directory">/lib</filename> directory.
129 To support those packages, create this symlink:</para>
130
131<screen><userinput remap="install">ln -sv ../usr/bin/cpp /lib</userinput></screen>
132
133 <para>Many packages use the name <command>cc</command> to call the C
134 compiler. To satisfy those packages, create a symlink:</para>
135
136<screen><userinput remap="install">ln -sv gcc /usr/bin/cc</userinput></screen>
137
138 <para>Add a compatibility symlink to enable building programs with
139 Link Time Optimization (LTO):</para>
140
141<screen><userinput remap="install">install -v -dm755 /usr/lib/bfd-plugins
142ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/&gcc-version;/liblto_plugin.so \
143 /usr/lib/bfd-plugins/</userinput></screen>
144
145 <para>Now that our final toolchain is in place, it is important to again ensure
146 that compiling and linking will work as expected. We do this by performing
147 the same sanity checks as we did earlier in the chapter:</para>
148
149 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
150 href="adjusting.xml"
151 xpointer="xpointer(//*[@os='a'])"/>
152
153 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
154 href="adjusting.xml"
155 xpointer="xpointer(//*[@os='b'])"/>
156
157 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
158 href="adjusting.xml"
159 xpointer="xpointer(//*[@os='c'])"/>
160
161 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
162 href="adjusting.xml"
163 xpointer="xpointer(//*[@os='d'])"/>
164
165 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
166 href="adjusting.xml"
167 xpointer="xpointer(//*[@os='e'])"/>
168
169 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
170 href="adjusting.xml"
171 xpointer="xpointer(//*[@os='f'])"/>
172
173<screen><computeroutput>/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crt1.o succeeded
174/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crti.o succeeded
175/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crtn.o succeeded</computeroutput></screen>
176
177 <para>Depending on your machine architecture, the above may differ slightly,
178 the difference usually being the name of the directory
179 after <filename class="directory">/usr/lib/gcc</filename>. If your machine is
180 a 64-bit system, you may also see a directory named <filename class="directory">lib64</filename>
181 towards the end of the string. The important thing to
182 look for here is that <command>gcc</command> has found all three
183 <filename>crt*.o</filename> files under the
184 <filename class="directory">/usr/lib</filename> directory.</para>
185
186 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
187 href="adjusting.xml"
188 xpointer="xpointer(//*[@os='g'])"/>
189
190<screen><userinput>grep -B4 '^ /usr/include' dummy.log</userinput></screen>
191
192 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
193 href="adjusting.xml"
194 xpointer="xpointer(//*[@os='h'])"/>
195
196<screen><computeroutput>#include &lt;...&gt; search starts here:
197 /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/include
198 /usr/local/include
199 /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/include-fixed
200 /usr/include</computeroutput></screen>
201
202 <para>Again, note that the directory named after your target triplet may be
203 different than the above, depending on your architecture.</para>
204
205 <note><para>As of version 4.3.0, GCC now unconditionally installs the
206 <filename>limits.h</filename> file into the private
207 <filename class="directory">include-fixed</filename> directory, and that
208 directory is required to be in place.</para></note>
209
210 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
211 href="adjusting.xml"
212 xpointer="xpointer(//*[@os='i'])"/>
213
214 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
215 href="adjusting.xml"
216 xpointer="xpointer(//*[@os='j'])"/>
217
218 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
219 href="adjusting.xml"
220 xpointer="xpointer(//*[@os='k'])"/>
221
222<screen><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib32")
223SEARCH_DIR("/usr/local/lib32")
224SEARCH_DIR("/lib32")
225SEARCH_DIR("/usr/lib32")
226SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
227SEARCH_DIR("/usr/local/lib")
228SEARCH_DIR("/lib")
229SEARCH_DIR("/usr/lib");</computeroutput></screen>
230
231 <para>A 64-bit system may see a few different directories. For example, here
232 is the output from an x86_64 machine:</para>
233
234<screen><computeroutput>SEARCH_DIR("/usr/x86_64-unknown-linux-gnu/lib64")
235SEARCH_DIR("/usr/local/lib64")
236SEARCH_DIR("/lib64")
237SEARCH_DIR("/usr/lib64")
238SEARCH_DIR("/usr/x86_64-unknown-linux-gnu/lib")
239SEARCH_DIR("/usr/local/lib")
240SEARCH_DIR("/lib")
241SEARCH_DIR("/usr/lib");</computeroutput></screen>
242
243 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
244 href="adjusting.xml"
245 xpointer="xpointer(//*[@os='l'])"/>
246
247 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
248 href="adjusting.xml"
249 xpointer="xpointer(//*[@os='m'])"/>
250
251 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
252 href="adjusting.xml"
253 xpointer="xpointer(//*[@os='n'])"/>
254
255 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
256 href="adjusting.xml"
257 xpointer="xpointer(//*[@os='o'])"/>
258
259 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
260 href="adjusting.xml"
261 xpointer="xpointer(//*[@os='p'])"/>
262
263 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
264 href="adjusting.xml"
265 xpointer="xpointer(//*[@os='q'])"/>
266
267 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
268 href="adjusting.xml"
269 xpointer="xpointer(//*[@os='r'])"/>
270
271 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
272 href="adjusting.xml"
273 xpointer="xpointer(//*[@os='s'])"/>
274
275 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
276 href="adjusting.xml"
277 xpointer="xpointer(//*[@os='t'])"/>
278
279 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
280 href="adjusting.xml"
281 xpointer="xpointer(//*[@os='u'])"/>
282
283 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
284 href="adjusting.xml"
285 xpointer="xpointer(//*[@os='v'])"/>
286
287 <para>Finally, move a misplaced file:</para>
288
289<screen><userinput remap="install">mkdir -pv /usr/share/gdb/auto-load/usr/lib
290mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
291
292 </sect2>
293
294 <sect2 id="contents-gcc" role="content">
295 <title>Contents of GCC</title>
296
297 <segmentedlist>
298 <segtitle>Installed programs</segtitle>
299 <segtitle>Installed libraries</segtitle>
300 <segtitle>Installed directories</segtitle>
301
302 <seglistitem>
303 <seg>c++, cc (link to gcc), cpp, g++, gcc,
304 gcc-ar, gcc-nm, gcc-ranlib, and gcov</seg>
305
306 <seg>libasan.{a,so}, libatomic.{a,so}, libgcc.a, libgcc_eh.a,
307 libgcc_s.so, libgcov.a, libgomp.{a,so}, libiberty.a, libitm.{a,so},
308 liblto_plugin.so,
309 libquadmath.{a,so}, libssp.{a,so},
310 libssp_nonshared.a, libstdc++.{a,so}, libsupc++.a, and libtsan.{a,so}</seg>
311
312 <seg>/usr/include/c++, /usr/lib/gcc, /usr/libexec/gcc, and
313 /usr/share/gcc-&gcc-version;</seg>
314 </seglistitem>
315 </segmentedlist>
316
317 <variablelist>
318 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
319 <?dbfo list-presentation="list"?>
320 <?dbhtml list-presentation="table"?>
321
322 <varlistentry id="c">
323 <term><command>c++</command></term>
324 <listitem>
325 <para>The C++ compiler</para>
326 <indexterm zone="ch-system-gcc c">
327 <primary sortas="b-c++">c++</primary>
328 </indexterm>
329 </listitem>
330 </varlistentry>
331
332 <varlistentry id="cc">
333 <term><command>cc</command></term>
334 <listitem>
335 <para>The C compiler</para>
336 <indexterm zone="ch-system-gcc cc">
337 <primary sortas="b-cc">cc</primary>
338 </indexterm>
339 </listitem>
340 </varlistentry>
341
342 <varlistentry id="cpp">
343 <term><command>cpp</command></term>
344 <listitem>
345 <para>The C preprocessor; it is used by the compiler to expand the
346 #include, #define, and similar statements in the source files</para>
347 <indexterm zone="ch-system-gcc cpp">
348 <primary sortas="b-cpp">cpp</primary>
349 </indexterm>
350 </listitem>
351 </varlistentry>
352
353 <varlistentry id="g">
354 <term><command>g++</command></term>
355 <listitem>
356 <para>The C++ compiler</para>
357 <indexterm zone="ch-system-gcc g">
358 <primary sortas="b-g++">g++</primary>
359 </indexterm>
360 </listitem>
361 </varlistentry>
362
363 <varlistentry id="gcc">
364 <term><command>gcc</command></term>
365 <listitem>
366 <para>The C compiler</para>
367 <indexterm zone="ch-system-gcc gcc">
368 <primary sortas="b-gcc">gcc</primary>
369 </indexterm>
370 </listitem>
371 </varlistentry>
372
373 <varlistentry id="gcc-ar">
374 <term><command>gcc-ar</command></term>
375 <listitem>
376 <para>A wrapper around <command>ar</command> that adds a
377 plugin to the command line. This program is only used
378 to add "link time optization" and is not useful with the
379 default build options</para>
380 <indexterm zone="ch-system-gcc gcc-ar">
381 <primary sortas="b-gcc-ar">gc-ar</primary>
382 </indexterm>
383 </listitem>
384 </varlistentry>
385
386 <varlistentry id="gcc-nm">
387 <term><command>gcc-nm</command></term>
388 <listitem>
389 <para>A wrapper around <command>nm</command> that adds a
390 plugin to the command line. This program is only used
391 to add "link time optization" and is not useful with the
392 default build options</para>
393 <indexterm zone="ch-system-gcc gcc-nm">
394 <primary sortas="b-gcc-nm">gc-nm</primary>
395 </indexterm>
396 </listitem>
397 </varlistentry>
398
399 <varlistentry id="gcc-ranlib">
400 <term><command>gcc-ranlib</command></term>
401 <listitem>
402 <para>A wrapper around <command>ranlib</command> that adds a
403 plugin to the command line. This program is only used
404 to add "link time optization" and is not useful with the
405 default build options</para>
406 <indexterm zone="ch-system-gcc gcc-ranlib">
407 <primary sortas="b-gcc-ranlib">gc-ranlib</primary>
408 </indexterm>
409 </listitem>
410 </varlistentry>
411
412 <varlistentry id="gcov">
413 <term><command>gcov</command></term>
414 <listitem>
415 <para>A coverage testing tool; it is used to analyze programs to
416 determine where optimizations will have the most effect</para>
417 <indexterm zone="ch-system-gcc gcov">
418 <primary sortas="b-gcov">gcov</primary>
419 </indexterm>
420 </listitem>
421 </varlistentry>
422
423 <varlistentry id="libasan">
424 <term><command>libasan</command></term>
425 <listitem>
426 <para>The Address Sanitizer runtime library</para>
427 <indexterm zone="ch-system-gcc libasan">
428 <primary sortas="b-libasan">libasan</primary>
429 </indexterm>
430 </listitem>
431 </varlistentry>
432
433 <varlistentry id="libgcc">
434 <term><filename class="libraryfile">libgcc</filename></term>
435 <listitem>
436 <para>Contains run-time support for <command>gcc</command></para>
437 <indexterm zone="ch-system-gcc libgcc">
438 <primary sortas="c-libgcc">libgcc</primary>
439 </indexterm>
440 </listitem>
441 </varlistentry>
442
443 <varlistentry id="libgcov">
444 <term><filename class="libraryfile">libgcov</filename></term>
445 <listitem>
446 <para>This library is linked in to a program when GCC is instructed
447 to enable profiling</para>
448 <indexterm zone="ch-system-gcc libgcov">
449 <primary sortas="c-libgcov">libgcov</primary>
450 </indexterm>
451 </listitem>
452 </varlistentry>
453
454 <varlistentry id="libgomp">
455 <term><filename class="libraryfile">libgomp</filename></term>
456 <listitem>
457 <para>GNU implementation of the OpenMP API for multi-platform
458 shared-memory parallel programming in C/C++ and Fortran</para>
459 <indexterm zone="ch-system-gcc libgomp">
460 <primary sortas="c-libgomp">libgomp</primary>
461 </indexterm>
462 </listitem>
463 </varlistentry>
464
465 <varlistentry id="libiberty">
466 <term><filename class="libraryfile">libiberty</filename></term>
467 <listitem>
468 <para>Contains routines used by various GNU programs, including
469 <command>getopt</command>, <command>obstack</command>,
470 <command>strerror</command>, <command>strtol</command>, and
471 <command>strtoul</command></para>
472 <indexterm zone="ch-system-gcc libiberty">
473 <primary sortas="c-libiberty">libiberty</primary>
474 </indexterm>
475 </listitem>
476 </varlistentry>
477
478 <varlistentry id="liblto_plugin">
479 <term><filename class="libraryfile">liblto_plugin</filename></term>
480 <listitem>
481 <para>GCC's Link Time Optimization (LTO) plugin allows GCC to perform
482 optimizations across compilation units</para>
483 <indexterm zone="ch-system-gcc liblto_plugin">
484 <primary sortas="c-liblto_plugin">liblto_plugin</primary>
485 </indexterm>
486 </listitem>
487 </varlistentry>
488
489 <varlistentry id="libquadmath">
490 <term><filename class="libraryfile">libquadmath</filename></term>
491 <listitem>
492 <para>GCC Quad Precision Math Library API</para>
493 <indexterm zone="ch-system-gcc libquadmath">
494 <primary sortas="c-libquadmath">libquadmath</primary>
495 </indexterm>
496 </listitem>
497 </varlistentry>
498
499 <varlistentry id="libssp">
500 <term><filename class="libraryfile">libssp</filename></term>
501 <listitem>
502 <para>Contains routines supporting GCC's stack-smashing protection
503 functionality</para>
504 <indexterm zone="ch-system-gcc libssp">
505 <primary sortas="c-libssp">libssp</primary>
506 </indexterm>
507 </listitem>
508 </varlistentry>
509
510 <varlistentry id="libstdc">
511 <term><filename class="libraryfile">libstdc++</filename></term>
512 <listitem>
513 <para>The standard C++ library</para>
514 <indexterm zone="ch-system-gcc libstdc">
515 <primary sortas="c-libstdc++">libstdc++</primary>
516 </indexterm>
517 </listitem>
518 </varlistentry>
519
520 <varlistentry id="libsupc">
521 <term><filename class="libraryfile">libsupc++</filename></term>
522 <listitem>
523 <para>Provides supporting routines for the C++ programming
524 language</para>
525 <indexterm zone="ch-system-gcc libsupc">
526 <primary sortas="c-libsupc++">libsupc++</primary>
527 </indexterm>
528 </listitem>
529 </varlistentry>
530
531 <varlistentry id="libtsan">
532 <term><filename class="libraryfile">libtsan</filename></term>
533 <listitem>
534 <para>The Thread Sanitizer runtime library</para>
535 <indexterm zone="ch-system-gcc libtsan">
536 <primary sortas="c-libtsan">libtsan</primary>
537 </indexterm>
538 </listitem>
539 </varlistentry>
540
541 </variablelist>
542
543 </sect2>
544
545</sect1>
Note: See TracBrowser for help on using the repository browser.