source: chapter06/gcc.xml@ 3f39abf3

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.4 6.5 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 3f39abf3 was 3f39abf3, checked in by DJ Lucas <dj@…>, 16 years ago

Added note about new gcc fixincludes, corrected test output - #2229.

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

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