source: chapter06/gcc.xml@ f1994dc

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since f1994dc was f1994dc, checked in by Matthew Burgess <matthew@…>, 15 years ago

Various text and grammar updates. Thanks to Chris Staub for the patch. Fixes #2458.

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

  • Property mode set to 100644
File size: 15.7 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>Apply a <command>sed</command> substitution that will suppress the
45 installation of <filename class="libraryfile">libiberty.a</filename>. The
46 version of <filename class="libraryfile">libiberty.a</filename> provided by
47 Binutils will be used instead:</para>
48
49<screen><userinput remap="pre">sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
50
51 <para>As in <xref linkend="ch-tools-gcc-pass2"/>, apply the following
52 <command>sed</command> to force the build to use the
53 <option>-fomit-frame-pointer</option> compiler flag in order to ensure
54 consistent compiler builds:</para>
55
56<screen><userinput remap="pre">case `uname -m` in
57 i?86) sed -i 's/^T_CFLAGS =$/&amp; -fomit-frame-pointer/' \
58 gcc/Makefile.in ;;
59esac</userinput></screen>
60
61 <para>The <command>fixincludes</command> script is known to occasionally
62 erroneously attempt to &quot;fix&quot; the system headers installed so far.
63 As the headers up to this point are known to not require fixing,
64 issue the following command to prevent the <command>fixincludes</command>
65 script from running:</para>
66
67<screen><userinput remap="pre">sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in</userinput></screen>
68
69 <para>The GCC documentation recommends building GCC outside of the source
70 directory in a dedicated build directory:</para>
71
72<screen><userinput remap="pre">mkdir -v ../gcc-build
73cd ../gcc-build</userinput></screen>
74
75 <para>Prepare GCC for compilation:</para>
76
77<screen><userinput remap="configure">../gcc-&gcc-version;/configure --prefix=/usr \
78 --libexecdir=/usr/lib --enable-shared \
79 --enable-threads=posix --enable-__cxa_atexit \
80 --enable-clocale=gnu --enable-languages=c,c++ \
81 --disable-multilib --disable-bootstrap</userinput></screen>
82
83 <para>Note that for other languages, there are some prerequisites that
84 are not available. See the BLFS Book for instructions on how to
85 build all the GCC supported languages.</para>
86
87 <para>Compile the package:</para>
88
89<screen><userinput remap="make">make</userinput></screen>
90
91 <important>
92 <para>In this section, the test suite for GCC is considered
93 critical. Do not skip it under any circumstance.</para>
94 </important>
95
96 <para>Test the results, but do not stop at errors:</para>
97
98<screen><userinput remap="test">make -k check</userinput></screen>
99
100 <para>To receive a summary of the test suite results, run:</para>
101
102<screen><userinput remap="test">../gcc-&gcc-version;/contrib/test_summary</userinput></screen>
103
104 <para>For only the summaries, pipe the output through
105 <userinput>grep -A7 Summ</userinput>.</para>
106
107 <para>Results can be compared with those located at <ulink
108 url="&test-results;"/> and <ulink url="http://gcc.gnu.org/ml/gcc-testresults/"/>.</para>
109
110 <para>A few unexpected failures cannot always be avoided. The GCC developers
111 are usually aware of these issues, but have not resolved them yet. In
112 particular, the <filename class="libraryfile">libmudflap</filename> tests
113 are known be particularly problematic as a result of a bug in GCC
114 (<ulink url="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20003"/>).
115 Unless the test results are vastly different from those at the above URL,
116 it is safe to continue.</para>
117
118 <para>Install the package:</para>
119
120<screen><userinput remap="install">make install</userinput></screen>
121
122 <para>Some packages expect the C preprocessor to be installed in the
123 <filename class="directory">/lib</filename> directory.
124 To support those packages, create this symlink:</para>
125
126<screen><userinput remap="install">ln -sv ../usr/bin/cpp /lib</userinput></screen>
127
128 <para>Many packages use the name <command>cc</command> to call the C
129 compiler. To satisfy those packages, create a symlink:</para>
130
131<screen><userinput remap="install">ln -sv gcc /usr/bin/cc</userinput></screen>
132
133 <para>Now that our final toolchain is in place, it is important to again ensure
134 that compiling and linking will work as expected. We do this by performing
135 the same sanity checks as we did earlier in the chapter:</para>
136
137 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
138 href="readjusting.xml"
139 xpointer="xpointer(//*[@os='a'])"/>
140
141 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
142 href="readjusting.xml"
143 xpointer="xpointer(//*[@os='b'])"/>
144
145 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
146 href="readjusting.xml"
147 xpointer="xpointer(//*[@os='c'])"/>
148
149 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
150 href="readjusting.xml"
151 xpointer="xpointer(//*[@os='d'])"/>
152
153 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
154 href="readjusting.xml"
155 xpointer="xpointer(//*[@os='e'])"/>
156
157 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
158 href="readjusting.xml"
159 xpointer="xpointer(//*[@os='f'])"/>
160
161<screen><computeroutput>/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crt1.o succeeded
162/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crti.o succeeded
163/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crtn.o succeeded</computeroutput></screen>
164
165 <para>Depending on your machine architecture, the above may differ slightly,
166 the difference usually being the name of the directory
167 after <filename class="directory">/usr/lib/gcc</filename>. If your machine is
168 a 64-bit system, you may also see a directory named <filename class="directory">lib64</filename>
169 towards the end of the string. The important thing to
170 look for here is that gcc has found all three <filename>crt*.o</filename> files under
171 the <filename class="directory">/usr/lib</filename> directory.</para>
172
173 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
174 href="readjusting.xml"
175 xpointer="xpointer(//*[@os='g'])"/>
176
177<screen><userinput>grep -B4 '^ /usr/include' dummy.log</userinput></screen>
178
179 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
180 href="readjusting.xml"
181 xpointer="xpointer(//*[@os='h'])"/>
182
183<screen><computeroutput>#include &lt;...&gt; search starts here:
184 /usr/local/include
185 /usr/lib/gcc/x86_64-unknown-linux-gnu/&gcc-version;/include
186 /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/include-fixed
187 /usr/include</computeroutput></screen>
188
189 <para>Again, note that the directory named after your target triplet may be
190 different than the above, depending on your architecture.</para>
191
192 <note><para>As of version 4.3.0, GCC now unconditionally installs the
193 <filename>limits.h</filename> file into the private
194 <filename class="directory">include-fixed</filename> directory, and that
195 directory is required to be in place.</para></note>
196
197 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
198 href="readjusting.xml"
199 xpointer="xpointer(//*[@os='i'])"/>
200
201 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
202 href="readjusting.xml"
203 xpointer="xpointer(//*[@os='j'])"/>
204
205 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
206 href="readjusting.xml"
207 xpointer="xpointer(//*[@os='k'])"/>
208
209<screen><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
210SEARCH_DIR("/usr/local/lib")
211SEARCH_DIR("/lib")
212SEARCH_DIR("/usr/lib");</computeroutput></screen>
213
214 <para>A 64-bit system may see a few more directories. For example, here
215 is the output from an x86_64 machine:</para>
216
217<screen><computeroutput>SEARCH_DIR("/usr/x86_64-unknown-linux-gnu/lib64")
218SEARCH_DIR("/usr/local/lib64")
219SEARCH_DIR("/lib64")
220SEARCH_DIR("/usr/lib64")
221SEARCH_DIR("/usr/x86_64-unknown-linux-gnu/lib")
222SEARCH_DIR("/usr/local/lib")
223SEARCH_DIR("/lib")
224SEARCH_DIR("/usr/lib");</computeroutput></screen>
225
226 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
227 href="readjusting.xml"
228 xpointer="xpointer(//*[@os='l'])"/>
229
230 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
231 href="readjusting.xml"
232 xpointer="xpointer(//*[@os='m'])"/>
233
234 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
235 href="readjusting.xml"
236 xpointer="xpointer(//*[@os='n'])"/>
237
238 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
239 href="readjusting.xml"
240 xpointer="xpointer(//*[@os='o'])"/>
241
242 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
243 href="readjusting.xml"
244 xpointer="xpointer(//*[@os='p'])"/>
245
246 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
247 href="readjusting.xml"
248 xpointer="xpointer(//*[@os='q'])"/>
249
250 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
251 href="readjusting.xml"
252 xpointer="xpointer(//*[@os='r'])"/>
253
254 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
255 href="readjusting.xml"
256 xpointer="xpointer(//*[@os='s'])"/>
257
258 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
259 href="readjusting.xml"
260 xpointer="xpointer(//*[@os='t'])"/>
261
262 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
263 href="readjusting.xml"
264 xpointer="xpointer(//*[@os='u'])"/>
265
266 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
267 href="readjusting.xml"
268 xpointer="xpointer(//*[@os='v'])"/>
269
270 </sect2>
271
272 <sect2 id="contents-gcc" role="content">
273 <title>Contents of GCC</title>
274
275 <segmentedlist>
276 <segtitle>Installed programs</segtitle>
277 <segtitle>Installed libraries</segtitle>
278
279 <seglistitem>
280 <seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcov</seg>
281 <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libgcov.a, libgomp.{a,so},
282 libmudflap.{a,so}, libmudflapth.{a,so}, libssp.{a,so},
283 libssp_nonshared.a, libstdc++.{a,so} and libsupc++.a</seg>
284 </seglistitem>
285 </segmentedlist>
286
287 <variablelist>
288 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
289 <?dbfo list-presentation="list"?>
290 <?dbhtml list-presentation="table"?>
291
292 <varlistentry id="c">
293 <term><command>c++</command></term>
294 <listitem>
295 <para>The C++ compiler</para>
296 <indexterm zone="ch-system-gcc c">
297 <primary sortas="b-c++">c++</primary>
298 </indexterm>
299 </listitem>
300 </varlistentry>
301
302 <varlistentry id="cc">
303 <term><command>cc</command></term>
304 <listitem>
305 <para>The C compiler</para>
306 <indexterm zone="ch-system-gcc cc">
307 <primary sortas="b-cc">cc</primary>
308 </indexterm>
309 </listitem>
310 </varlistentry>
311
312 <varlistentry id="cpp">
313 <term><command>cpp</command></term>
314 <listitem>
315 <para>The C preprocessor; it is used by the compiler to expand the
316 #include, #define, and similar statements in the source files</para>
317 <indexterm zone="ch-system-gcc cpp">
318 <primary sortas="b-cpp">cpp</primary>
319 </indexterm>
320 </listitem>
321 </varlistentry>
322
323 <varlistentry id="g">
324 <term><command>g++</command></term>
325 <listitem>
326 <para>The C++ compiler</para>
327 <indexterm zone="ch-system-gcc g">
328 <primary sortas="b-g++">g++</primary>
329 </indexterm>
330 </listitem>
331 </varlistentry>
332
333 <varlistentry id="gcc">
334 <term><command>gcc</command></term>
335 <listitem>
336 <para>The C compiler</para>
337 <indexterm zone="ch-system-gcc gcc">
338 <primary sortas="b-gcc">gcc</primary>
339 </indexterm>
340 </listitem>
341 </varlistentry>
342
343 <varlistentry id="gccbug">
344 <term><command>gccbug</command></term>
345 <listitem>
346 <para>A shell script used to help create useful bug reports</para>
347 <indexterm zone="ch-system-gcc gccbug">
348 <primary sortas="b-gccbug">gccbug</primary>
349 </indexterm>
350 </listitem>
351 </varlistentry>
352
353 <varlistentry id="gcov">
354 <term><command>gcov</command></term>
355 <listitem>
356 <para>A coverage testing tool; it is used to analyze programs to
357 determine where optimizations will have the most effect</para>
358 <indexterm zone="ch-system-gcc gcov">
359 <primary sortas="b-gcov">gcov</primary>
360 </indexterm>
361 </listitem>
362 </varlistentry>
363
364 <varlistentry id="libgcc">
365 <term><filename class="libraryfile">libgcc</filename></term>
366 <listitem>
367 <para>Contains run-time support for <command>gcc</command></para>
368 <indexterm zone="ch-system-gcc libgcc">
369 <primary sortas="c-libgcc*">libgcc*</primary>
370 </indexterm>
371 </listitem>
372 </varlistentry>
373
374 <varlistentry id="libgcov">
375 <term><filename class="libraryfile">libgcov</filename></term>
376 <listitem>
377 <para>This library is linked in to a program when GCC is instructed
378 to enable profiling</para>
379 <indexterm zone="ch-system-gcc libgcov">
380 <primary sortas="c-libgcov">libgcov</primary>
381 </indexterm>
382 </listitem>
383 </varlistentry>
384
385 <varlistentry id="libgomp">
386 <term><filename class="libraryfile">libgomp</filename></term>
387 <listitem>
388 <para>GNU implementation of the OpenMP API for multi-platform
389 shared-memory parallel programming in C/C++ and Fortran</para>
390 <indexterm zone="ch-system-gcc libgomp">
391 <primary sortas="c-libgomp">libgomp</primary>
392 </indexterm>
393 </listitem>
394 </varlistentry>
395
396 <varlistentry id="libmudflap">
397 <term><filename class="libraryfile">libmudflap</filename></term>
398 <listitem>
399 <para>Contains routines that support GCC's bounds checking
400 functionality</para>
401 <indexterm zone="ch-system-gcc libmudflap">
402 <primary sortas="c-libmudflap*">libmudflap*</primary>
403 </indexterm>
404 </listitem>
405 </varlistentry>
406
407 <varlistentry id="libssp">
408 <term><filename class="libraryfile">libssp</filename></term>
409 <listitem>
410 <para>Contains routines supporting GCC's stack-smashing protection
411 functionality</para>
412 <indexterm zone="ch-system-gcc libssp">
413 <primary sortas="c-libssp*">libssp*</primary>
414 </indexterm>
415 </listitem>
416 </varlistentry>
417
418 <varlistentry id="libstdc">
419 <term><filename class="libraryfile">libstdc++</filename></term>
420 <listitem>
421 <para>The standard C++ library</para>
422 <indexterm zone="ch-system-gcc libstdc">
423 <primary sortas="c-libstdc++">libstdc++</primary>
424 </indexterm>
425 </listitem>
426 </varlistentry>
427
428 <varlistentry id="libsupc">
429 <term><filename class="libraryfile">libsupc++</filename></term>
430 <listitem>
431 <para>Provides supporting routines for the C++ programming
432 language</para>
433 <indexterm zone="ch-system-gcc libsupc">
434 <primary sortas="c-libsupc++">libsupc++</primary>
435 </indexterm>
436 </listitem>
437 </varlistentry>
438
439 </variablelist>
440
441 </sect2>
442
443</sect1>
Note: See TracBrowser for help on using the repository browser.