source: chapter06/gcc.xml@ 1eb4791

Last change on this file since 1eb4791 was 28b40e2, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Finished the PDF fixes.

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

  • Property mode set to 100644
File size: 12.0 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/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++</userinput></screen>
81
82 <para>Compile the package:</para>
83
84<screen><userinput>make</userinput></screen>
85
86 <beginpage/>
87
88 <important>
89 <para>In this section, the test suite for GCC is considered
90 critical. Do not skip it under any circumstance.</para>
91 </important>
92
93 <para>Test the results, but do not stop at errors:</para>
94
95<screen><userinput>make -k check</userinput></screen>
96
97 <para>To receive a summary of the test suite results, run:</para>
98
99<screen><userinput>../gcc-&gcc-version;/contrib/test_summary</userinput></screen>
100
101 <para>For only the summaries, pipe the output through
102 <userinput>grep -A7 Summ</userinput>.</para>
103
104 <para>Results can be compared with those located at <ulink
105 url="&test-results;"/>.</para>
106
107 <para>A few unexpected failures cannot always be avoided. The GCC developers
108 are usually aware of these issues, but have not resolved them yet. In
109 particular, the <filename class="libraryfile">libmudflap</filename> tests
110 are known be particularly problematic as a result of a bug in GCC
111 (<ulink url="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20003"/>).
112 Unless the test results are vastly different from those at the above URL,
113 it is safe to continue.</para>
114
115 <para>Install the package:</para>
116
117<screen><userinput>make install</userinput></screen>
118
119 <para>Some packages expect the C preprocessor to be installed in the
120 <filename class="directory">/lib</filename> directory.
121 To support those packages, create this symlink:</para>
122
123<screen><userinput>ln -sv ../usr/bin/cpp /lib</userinput></screen>
124
125 <para>Many packages use the name <command>cc</command> to call the C
126 compiler. To satisfy those packages, create a symlink:</para>
127
128<screen><userinput>ln -sv gcc /usr/bin/cc</userinput></screen>
129
130 <para>Now that our final toolchain is in place, it is important to again ensure
131 that compiling and linking will work as expected. We do this by performing
132 the same sanity checks as we did earlier in the chapter:</para>
133
134 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
135 href="readjusting.xml"
136 xpointer="xpointer(//*[@os='a'])"/>
137
138 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
139 href="readjusting.xml"
140 xpointer="xpointer(//*[@os='b'])"/>
141
142 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
143 href="readjusting.xml"
144 xpointer="xpointer(//*[@os='c'])"/>
145
146 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
147 href="readjusting.xml"
148 xpointer="xpointer(//*[@os='d'])"/>
149
150 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
151 href="readjusting.xml"
152 xpointer="xpointer(//*[@os='e'])"/>
153
154 <beginpage/>
155
156 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
157 href="readjusting.xml"
158 xpointer="xpointer(//*[@os='f'])"/>
159
160<screen><computeroutput>/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crt1.o succeeded
161/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crti.o succeeded
162/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crtn.o succeeded</computeroutput></screen>
163
164 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
165 href="readjusting.xml"
166 xpointer="xpointer(//*[@os='g'])"/>
167
168 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
169 href="readjusting.xml"
170 xpointer="xpointer(//*[@os='h'])"/>
171
172 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
173 href="readjusting.xml"
174 xpointer="xpointer(//*[@os='i'])"/>
175
176<screen><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
177SEARCH_DIR("/usr/local/lib")
178SEARCH_DIR("/lib")
179SEARCH_DIR("/usr/lib");</computeroutput></screen>
180
181 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
182 href="readjusting.xml"
183 xpointer="xpointer(//*[@os='j'])"/>
184
185 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
186 href="readjusting.xml"
187 xpointer="xpointer(//*[@os='k'])"/>
188
189 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
190 href="readjusting.xml"
191 xpointer="xpointer(//*[@os='l'])"/>
192
193 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
194 href="readjusting.xml"
195 xpointer="xpointer(//*[@os='m'])"/>
196
197 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
198 href="readjusting.xml"
199 xpointer="xpointer(//*[@os='n'])"/>
200
201 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
202 href="readjusting.xml"
203 xpointer="xpointer(//*[@os='o'])"/>
204
205 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
206 href="readjusting.xml"
207 xpointer="xpointer(//*[@os='p'])"/>
208
209 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
210 href="readjusting.xml"
211 xpointer="xpointer(//*[@os='q'])"/>
212
213 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
214 href="readjusting.xml"
215 xpointer="xpointer(//*[@os='r'])"/>
216
217 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
218 href="readjusting.xml"
219 xpointer="xpointer(//*[@os='s'])"/>
220
221 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
222 href="readjusting.xml"
223 xpointer="xpointer(//*[@os='t'])"/>
224
225 <beginpage/>
226
227 </sect2>
228
229 <sect2 id="contents-gcc" role="content">
230 <title>Contents of GCC</title>
231
232 <segmentedlist>
233 <segtitle>Installed programs</segtitle>
234 <segtitle>Installed libraries</segtitle>
235
236 <seglistitem>
237 <seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcov</seg>
238 <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.{a,so}, and
239 libsupc++.a</seg>
240 </seglistitem>
241 </segmentedlist>
242
243 <variablelist>
244 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
245 <?dbfo list-presentation="list"?>
246 <?dbhtml list-presentation="table"?>
247
248 <varlistentry id="cc">
249 <term><command>cc</command></term>
250 <listitem>
251 <para>The C compiler</para>
252 <indexterm zone="ch-system-gcc cc">
253 <primary sortas="b-cc">cc</primary>
254 </indexterm>
255 </listitem>
256 </varlistentry>
257
258 <varlistentry id="cpp">
259 <term><command>cpp</command></term>
260 <listitem>
261 <para>The C preprocessor; it is used by the compiler to expand the
262 #include, #define, and similar statements in the source files</para>
263 <indexterm zone="ch-system-gcc cpp">
264 <primary sortas="b-cpp">cpp</primary>
265 </indexterm>
266 </listitem>
267 </varlistentry>
268
269 <varlistentry id="c">
270 <term><command>c++</command></term>
271 <listitem>
272 <para>The C++ compiler</para>
273 <indexterm zone="ch-system-gcc c">
274 <primary sortas="b-c++">c++</primary>
275 </indexterm>
276 </listitem>
277 </varlistentry>
278
279 <varlistentry id="g">
280 <term><command>g++</command></term>
281 <listitem>
282 <para>The C++ compiler</para>
283 <indexterm zone="ch-system-gcc g">
284 <primary sortas="b-g++">g++</primary>
285 </indexterm>
286 </listitem>
287 </varlistentry>
288
289 <varlistentry id="gcc">
290 <term><command>gcc</command></term>
291 <listitem>
292 <para>The C compiler</para>
293 <indexterm zone="ch-system-gcc gcc">
294 <primary sortas="b-gcc">gcc</primary>
295 </indexterm>
296 </listitem>
297 </varlistentry>
298
299 <varlistentry id="gccbug">
300 <term><command>gccbug</command></term>
301 <listitem>
302 <para>A shell script used to help create useful bug reports</para>
303 <indexterm zone="ch-system-gcc gccbug">
304 <primary sortas="b-gccbug">gccbug</primary>
305 </indexterm>
306 </listitem>
307 </varlistentry>
308
309 <varlistentry id="gcov">
310 <term><command>gcov</command></term>
311 <listitem>
312 <para>A coverage testing tool; it is used to analyze programs to
313 determine where optimizations will have the most effect</para>
314 <indexterm zone="ch-system-gcc gcov">
315 <primary sortas="b-gcov">gcov</primary>
316 </indexterm>
317 </listitem>
318 </varlistentry>
319
320 <varlistentry id="libgcc">
321 <term><filename class="libraryfile">libgcc</filename></term>
322 <listitem>
323 <para>Contains run-time support for <command>gcc</command></para>
324 <indexterm zone="ch-system-gcc libgcc">
325 <primary sortas="c-libgcc*">libgcc*</primary>
326 </indexterm>
327 </listitem>
328 </varlistentry>
329
330 <varlistentry id="libstdc">
331 <term><filename class="libraryfile">libstdc++</filename></term>
332 <listitem>
333 <para>The standard C++ library</para>
334 <indexterm zone="ch-system-gcc libstdc">
335 <primary sortas="c-libstdc++">libstdc++</primary>
336 </indexterm>
337 </listitem>
338 </varlistentry>
339
340 <varlistentry id="libsupc">
341 <term><filename class="libraryfile">libsupc++</filename></term>
342 <listitem>
343 <para>Provides supporting routines for the C++ programming
344 language</para>
345 <indexterm zone="ch-system-gcc libsupc">
346 <primary sortas="c-libsupc++">libsupc++</primary>
347 </indexterm>
348 </listitem>
349 </varlistentry>
350
351 </variablelist>
352
353 </sect2>
354
355</sect1>
Note: See TracBrowser for help on using the repository browser.