source: chapter06/gcc.xml@ 182d5d3

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 182d5d3 was 182d5d3, checked in by Bruce Dubbs <bdubbs@…>, 16 years ago

Text changes in several places in Chapters 5 and 6.

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

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