source: chapter06/gcc.xml@ 0a6f214

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 0a6f214 was 0a6f214, checked in by Dan Nichilson <dnicholson@…>, 17 years ago

Fix post-GCC sanity check headers path

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8120 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 -B3 '^ /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/local/include
172 /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/include
173 /usr/include</computeroutput></screen>
174
175 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
176 href="readjusting.xml"
177 xpointer="xpointer(//*[@os='i'])"/>
178
179 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
180 href="readjusting.xml"
181 xpointer="xpointer(//*[@os='j'])"/>
182
183 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
184 href="readjusting.xml"
185 xpointer="xpointer(//*[@os='k'])"/>
186
187<screen><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
188SEARCH_DIR("/usr/local/lib")
189SEARCH_DIR("/lib")
190SEARCH_DIR("/usr/lib");</computeroutput></screen>
191
192 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
193 href="readjusting.xml"
194 xpointer="xpointer(//*[@os='l'])"/>
195
196 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
197 href="readjusting.xml"
198 xpointer="xpointer(//*[@os='m'])"/>
199
200 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
201 href="readjusting.xml"
202 xpointer="xpointer(//*[@os='n'])"/>
203
204 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
205 href="readjusting.xml"
206 xpointer="xpointer(//*[@os='o'])"/>
207
208 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
209 href="readjusting.xml"
210 xpointer="xpointer(//*[@os='p'])"/>
211
212 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
213 href="readjusting.xml"
214 xpointer="xpointer(//*[@os='q'])"/>
215
216 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
217 href="readjusting.xml"
218 xpointer="xpointer(//*[@os='r'])"/>
219
220 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
221 href="readjusting.xml"
222 xpointer="xpointer(//*[@os='s'])"/>
223
224 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
225 href="readjusting.xml"
226 xpointer="xpointer(//*[@os='t'])"/>
227
228 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
229 href="readjusting.xml"
230 xpointer="xpointer(//*[@os='u'])"/>
231
232 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
233 href="readjusting.xml"
234 xpointer="xpointer(//*[@os='v'])"/>
235
236 </sect2>
237
238 <sect2 id="contents-gcc" role="content">
239 <title>Contents of GCC</title>
240
241 <segmentedlist>
242 <segtitle>Installed programs</segtitle>
243 <segtitle>Installed libraries</segtitle>
244
245 <seglistitem>
246 <seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcov</seg>
247 <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.{a,so}, and
248 libsupc++.a</seg>
249 </seglistitem>
250 </segmentedlist>
251
252 <variablelist>
253 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
254 <?dbfo list-presentation="list"?>
255 <?dbhtml list-presentation="table"?>
256
257 <varlistentry id="cc">
258 <term><command>cc</command></term>
259 <listitem>
260 <para>The C compiler</para>
261 <indexterm zone="ch-system-gcc cc">
262 <primary sortas="b-cc">cc</primary>
263 </indexterm>
264 </listitem>
265 </varlistentry>
266
267 <varlistentry id="cpp">
268 <term><command>cpp</command></term>
269 <listitem>
270 <para>The C preprocessor; it is used by the compiler to expand the
271 #include, #define, and similar statements in the source files</para>
272 <indexterm zone="ch-system-gcc cpp">
273 <primary sortas="b-cpp">cpp</primary>
274 </indexterm>
275 </listitem>
276 </varlistentry>
277
278 <varlistentry id="c">
279 <term><command>c++</command></term>
280 <listitem>
281 <para>The C++ compiler</para>
282 <indexterm zone="ch-system-gcc c">
283 <primary sortas="b-c++">c++</primary>
284 </indexterm>
285 </listitem>
286 </varlistentry>
287
288 <varlistentry id="g">
289 <term><command>g++</command></term>
290 <listitem>
291 <para>The C++ compiler</para>
292 <indexterm zone="ch-system-gcc g">
293 <primary sortas="b-g++">g++</primary>
294 </indexterm>
295 </listitem>
296 </varlistentry>
297
298 <varlistentry id="gcc">
299 <term><command>gcc</command></term>
300 <listitem>
301 <para>The C compiler</para>
302 <indexterm zone="ch-system-gcc gcc">
303 <primary sortas="b-gcc">gcc</primary>
304 </indexterm>
305 </listitem>
306 </varlistentry>
307
308 <varlistentry id="gccbug">
309 <term><command>gccbug</command></term>
310 <listitem>
311 <para>A shell script used to help create useful bug reports</para>
312 <indexterm zone="ch-system-gcc gccbug">
313 <primary sortas="b-gccbug">gccbug</primary>
314 </indexterm>
315 </listitem>
316 </varlistentry>
317
318 <varlistentry id="gcov">
319 <term><command>gcov</command></term>
320 <listitem>
321 <para>A coverage testing tool; it is used to analyze programs to
322 determine where optimizations will have the most effect</para>
323 <indexterm zone="ch-system-gcc gcov">
324 <primary sortas="b-gcov">gcov</primary>
325 </indexterm>
326 </listitem>
327 </varlistentry>
328
329 <varlistentry id="libgcc">
330 <term><filename class="libraryfile">libgcc</filename></term>
331 <listitem>
332 <para>Contains run-time support for <command>gcc</command></para>
333 <indexterm zone="ch-system-gcc libgcc">
334 <primary sortas="c-libgcc*">libgcc*</primary>
335 </indexterm>
336 </listitem>
337 </varlistentry>
338
339 <varlistentry id="libstdc">
340 <term><filename class="libraryfile">libstdc++</filename></term>
341 <listitem>
342 <para>The standard C++ library</para>
343 <indexterm zone="ch-system-gcc libstdc">
344 <primary sortas="c-libstdc++">libstdc++</primary>
345 </indexterm>
346 </listitem>
347 </varlistentry>
348
349 <varlistentry id="libsupc">
350 <term><filename class="libraryfile">libsupc++</filename></term>
351 <listitem>
352 <para>Provides supporting routines for the C++ programming
353 language</para>
354 <indexterm zone="ch-system-gcc libsupc">
355 <primary sortas="c-libsupc++">libsupc++</primary>
356 </indexterm>
357 </listitem>
358 </varlistentry>
359
360 </variablelist>
361
362 </sect2>
363
364</sect1>
Note: See TracBrowser for help on using the repository browser.