source: chapter06/gcc.xml@ d05500f

Last change on this file since d05500f was d05500f, checked in by Jeremy Huntwork <jhuntwork@…>, 17 years ago

More accurate results for the sanity tests.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/x86_64/BOOK@8249 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 <title>GCC-&gcc-version;</title>
12
13 <indexterm zone="ch-system-gcc">
14 <primary sortas="a-GCC">GCC</primary>
15 </indexterm>
16
17 <sect2 role="package">
18 <title/>
19
20 <para>The GCC package contains the GNU compiler collection, which includes
21 the C and C++ compilers.</para>
22
23 <segmentedlist>
24 <segtitle>&buildtime;</segtitle>
25 <segtitle>&diskspace;</segtitle>
26
27 <seglistitem>
28 <seg>&gcc-ch6-sbu;</seg>
29 <seg>&gcc-ch6-du;</seg>
30 </seglistitem>
31 </segmentedlist>
32
33 </sect2>
34
35 <sect2 role="installation">
36 <title>Installation of GCC</title>
37
38 <para>Apply a <command>sed</command> substitution that will suppress the
39 installation of <filename class="libraryfile">libiberty.a</filename>. The
40 version of <filename class="libraryfile">libiberty.a</filename> provided by
41 Binutils will be used instead:</para>
42
43<screen><userinput>sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
44
45 <para>The bootstrap build performed in <xref linkend="ch-tools-gcc-pass1"/>
46 built GCC with the <option>-fomit-frame-pointer</option> compiler flag.
47 Non-bootstrap builds omit this flag by default, so apply the following
48 <command>sed</command> to use it in order to ensure consistent compiler
49 builds:</para>
50
51<screen><userinput>sed -i 's/^XCFLAGS =$/&amp; -fomit-frame-pointer/' gcc/Makefile.in</userinput></screen>
52
53 <para>The <command>fixincludes</command> script is known to occasionally
54 erroneously attempt to &quot;fix&quot; the system headers installed so far. As
55 the headers installed by GCC-&gcc-version; and Glibc-&glibc-version; are known
56 to not require fixing, issue the following command to prevent the
57 <command>fixincludes</command> script from running:</para>
58
59<screen><userinput>sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in</userinput></screen>
60
61 <para>GCC provides a <command>gccbug</command> script which detects at
62 compile time whether mktemp is present, and hardcodes the result in a test.
63 This will cause the script to fall back to using less random names for
64 temporary files. We will be installing mktemp later, so the following sed
65 will simulate its presence:</para>
66
67<screen><userinput>sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.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>mkdir -v ../gcc-build
73cd ../gcc-build</userinput></screen>
74
75 <para>Prepare GCC for compilation:</para>
76
77<screen><userinput>../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</userinput></screen>
82
83 <para>Compile the package:</para>
84
85<screen><userinput>make</userinput></screen>
86
87 <important>
88 <para>In this section, the test suite for GCC is considered
89 critical. Do not skip it under any circumstance.</para>
90 </important>
91
92 <para>Test the results, but do not stop at errors:</para>
93
94<screen><userinput>make -k check</userinput></screen>
95
96 <para>To receive a summary of the test suite results, run:</para>
97
98<screen><userinput>../gcc-&gcc-version;/contrib/test_summary</userinput></screen>
99
100 <para>For only the summaries, pipe the output through
101 <userinput>grep -A7 Summ</userinput>.</para>
102
103 <para>Results can be compared with those located at <ulink
104 url="&test-results;"/>.</para>
105
106 <para>A few unexpected failures cannot always be avoided. The GCC developers
107 are usually aware of these issues, but have not resolved them yet. In
108 particular, the <filename class="libraryfile">libmudflap</filename> tests
109 are known be particularly problematic as a result of a bug in GCC
110 (<ulink url="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20003"/>).
111 Unless the test results are vastly different from those at the above URL,
112 it is safe to continue.</para>
113
114 <para>Install the package:</para>
115
116<screen><userinput>make install</userinput></screen>
117
118 <para>Some packages expect the C preprocessor to be installed in the
119 <filename class="directory">/lib</filename> directory.
120 To support those packages, create this symlink:</para>
121
122<screen><userinput>ln -sv ../usr/bin/cpp /lib</userinput></screen>
123
124 <para>Many packages use the name <command>cc</command> to call the C
125 compiler. To satisfy those packages, create a symlink:</para>
126
127<screen><userinput>ln -sv gcc /usr/bin/cc</userinput></screen>
128
129 <para>Now that our final toolchain is in place, it is important to again ensure
130 that compiling and linking will work as expected. We do this by performing
131 the same sanity checks as we did earlier in the chapter:</para>
132
133 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
134 href="readjusting.xml"
135 xpointer="xpointer(//*[@os='a'])"/>
136
137 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
138 href="readjusting.xml"
139 xpointer="xpointer(//*[@os='b'])"/>
140
141 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
142 href="readjusting.xml"
143 xpointer="xpointer(//*[@os='c'])"/>
144
145 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
146 href="readjusting.xml"
147 xpointer="xpointer(//*[@os='d'])"/>
148
149 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
150 href="readjusting.xml"
151 xpointer="xpointer(//*[@os='e'])"/>
152
153 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
154 href="readjusting.xml"
155 xpointer="xpointer(//*[@os='f'])"/>
156
157<screen><computeroutput>/usr/lib/gcc/x86_64-unknown-linux-gnu/&gcc-version;/../../../../lib64/crt1.o succeeded
158/usr/lib/gcc/x86_64-unknown-linux-gnu/&gcc-version;/../../../../lib64/crti.o succeeded
159/usr/lib/gcc/x86_64-unknown-linux-gnu/&gcc-version;/../../../../lib64/crtn.o succeeded</computeroutput></screen>
160
161 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
162 href="readjusting.xml"
163 xpointer="xpointer(//*[@os='g'])"/>
164
165<screen><userinput>grep -B3 '^ /usr/include' dummy.log</userinput></screen>
166
167 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
168 href="readjusting.xml"
169 xpointer="xpointer(//*[@os='h'])"/>
170
171<screen><computeroutput>#include &lt;...&gt; search starts here:
172 /usr/local/include
173 /usr/lib/gcc/x86_64-unknown-linux-gnu/&gcc-version;/include
174 /usr/include</computeroutput></screen>
175
176 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
177 href="readjusting.xml"
178 xpointer="xpointer(//*[@os='i'])"/>
179
180 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
181 href="readjusting.xml"
182 xpointer="xpointer(//*[@os='j'])"/>
183
184 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
185 href="readjusting.xml"
186 xpointer="xpointer(//*[@os='k'])"/>
187
188<screen><computeroutput>SEARCH_DIR("/usr/x86_64-unknown-linux-gnu/lib64")
189SEARCH_DIR("/usr/local/lib64")
190SEARCH_DIR("/lib64")
191SEARCH_DIR("/usr/lib64")
192SEARCH_DIR("/usr/x86_64-unknown-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.