source: chapter06/gcc.xml@ 006ed03

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.3 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 006ed03 was 006ed03, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Removed nodump attributes from chapter06 readjusting and GCC sanity checks.

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

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