source: chapter06/gcc.xml@ 615a565

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 615a565 was 0445a3d, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added remap attributes to userinput tags in packages pages.

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

  • Property mode set to 100644
File size: 13.6 KB
RevLine 
[673b0d8]1<?xml version="1.0" encoding="ISO-8859-1"?>
[b06ca36]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
[673b0d8]4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
[6a82dd9]7
[81fd230]8<sect1 id="ch-system-gcc" role="wrap">
[6a82dd9]9 <?dbhtml filename="gcc.html"?>
10
[e747759]11 <sect1info condition="script">
12 <productname>gcc</productname>
13 <productnumber>&gcc-version;</productnumber>
14 <address>&gcc-url;</address>
15 </sect1info>
16
[6a82dd9]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/>
[6370fa6]25
[6a82dd9]26 <para>The GCC package contains the GNU compiler collection, which includes
27 the C and C++ compilers.</para>
[673b0d8]28
[6a82dd9]29 <segmentedlist>
30 <segtitle>&buildtime;</segtitle>
31 <segtitle>&diskspace;</segtitle>
[5888299]32
[6a82dd9]33 <seglistitem>
[e4a5635]34 <seg>&gcc-ch6-sbu;</seg>
35 <seg>&gcc-ch6-du;</seg>
[6a82dd9]36 </seglistitem>
37 </segmentedlist>
[3554fa3a]38
[6a82dd9]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>
[37dcf2a]48
[0445a3d]49<screen><userinput remap="pre">sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
[73aedd1d]50
[6a82dd9]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
[f19e766]55 builds:</para>
[2e02c35]56
[0445a3d]57<screen><userinput remap="pre">sed -i 's/^XCFLAGS =$/&amp; -fomit-frame-pointer/' gcc/Makefile.in</userinput></screen>
[2e02c35]58
[6a82dd9]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>
[27ced84]64
[0445a3d]65<screen><userinput remap="pre">sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in</userinput></screen>
[27ced84]66
[6a82dd9]67 <para>GCC provides a <command>gccbug</command> script which detects at
68 compile time whether mktemp is present, and hardcodes the result in a test.
69 This will cause the script to fall back to using less random names for
70 temporary files. We will be installing mktemp later, so the following sed
[f19e766]71 will simulate its presence:</para>
[3154d10b]72
[0445a3d]73<screen><userinput remap="pre">sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in</userinput></screen>
[3154d10b]74
[6a82dd9]75 <para>The GCC documentation recommends building GCC outside of the source
76 directory in a dedicated build directory:</para>
[73aedd1d]77
[0445a3d]78<screen><userinput remap="pre">mkdir -v ../gcc-build
[73aedd1d]79cd ../gcc-build</userinput></screen>
80
[6a82dd9]81 <para>Prepare GCC for compilation:</para>
[73aedd1d]82
[0445a3d]83<screen><userinput remap="configure">../gcc-&gcc-version;/configure --prefix=/usr \
[d72e04a]84 --libexecdir=/usr/lib --enable-shared \
85 --enable-threads=posix --enable-__cxa_atexit \
[b0a4c9a]86 --enable-clocale=gnu --enable-languages=c,c++ \
87 --disable-bootstrap</userinput></screen>
[73aedd1d]88
[6a82dd9]89 <para>Compile the package:</para>
[73aedd1d]90
[0445a3d]91<screen><userinput remap="make">make</userinput></screen>
[73aedd1d]92
[6a82dd9]93 <important>
94 <para>In this section, the test suite for GCC is considered
95 critical. Do not skip it under any circumstance.</para>
96 </important>
[81fd230]97
[6a82dd9]98 <para>Test the results, but do not stop at errors:</para>
[73aedd1d]99
[0445a3d]100<screen><userinput remap="test">make -k check</userinput></screen>
[73aedd1d]101
[9278974d]102 <para>To receive a summary of the test suite results, run:</para>
103
[0445a3d]104<screen><userinput remap="test">../gcc-&gcc-version;/contrib/test_summary</userinput></screen>
[9278974d]105
106 <para>For only the summaries, pipe the output through
107 <userinput>grep -A7 Summ</userinput>.</para>
108
109 <para>Results can be compared with those located at <ulink
110 url="&test-results;"/>.</para>
111
112 <para>A few unexpected failures cannot always be avoided. The GCC developers
113 are usually aware of these issues, but have not resolved them yet. In
114 particular, the <filename class="libraryfile">libmudflap</filename> tests
115 are known be particularly problematic as a result of a bug in GCC
116 (<ulink url="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20003"/>).
117 Unless the test results are vastly different from those at the above URL,
118 it is safe to continue.</para>
[73aedd1d]119
[6a82dd9]120 <para>Install the package:</para>
[73aedd1d]121
[0445a3d]122<screen><userinput remap="install">make install</userinput></screen>
[73aedd1d]123
[6a82dd9]124 <para>Some packages expect the C preprocessor to be installed in the
125 <filename class="directory">/lib</filename> directory.
126 To support those packages, create this symlink:</para>
[73aedd1d]127
[0445a3d]128<screen><userinput remap="install">ln -sv ../usr/bin/cpp /lib</userinput></screen>
[73aedd1d]129
[6a82dd9]130 <para>Many packages use the name <command>cc</command> to call the C
131 compiler. To satisfy those packages, create a symlink:</para>
[1ba726f]132
[0445a3d]133<screen><userinput remap="install">ln -sv gcc /usr/bin/cc</userinput></screen>
[1ba726f]134
[09f1daf]135 <para>Now that our final toolchain is in place, it is important to again ensure
136 that compiling and linking will work as expected. We do this by performing
137 the same sanity checks as we did earlier in the chapter:</para>
138
139 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
140 href="readjusting.xml"
141 xpointer="xpointer(//*[@os='a'])"/>
142
143 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
144 href="readjusting.xml"
145 xpointer="xpointer(//*[@os='b'])"/>
146
147 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
148 href="readjusting.xml"
149 xpointer="xpointer(//*[@os='c'])"/>
150
151 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
152 href="readjusting.xml"
153 xpointer="xpointer(//*[@os='d'])"/>
154
155 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
156 href="readjusting.xml"
157 xpointer="xpointer(//*[@os='e'])"/>
158
159 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
160 href="readjusting.xml"
161 xpointer="xpointer(//*[@os='f'])"/>
162
163<screen><computeroutput>/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crt1.o succeeded
164/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crti.o succeeded
165/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crtn.o succeeded</computeroutput></screen>
166
167 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
168 href="readjusting.xml"
169 xpointer="xpointer(//*[@os='g'])"/>
170
[0a6f214]171<screen><userinput>grep -B3 '^ /usr/include' dummy.log</userinput></screen>
[e9a652b]172
[09f1daf]173 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
174 href="readjusting.xml"
175 xpointer="xpointer(//*[@os='h'])"/>
176
[e9a652b]177<screen><computeroutput>#include &lt;...&gt; search starts here:
[0a6f214]178 /usr/local/include
[e9a652b]179 /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/include
180 /usr/include</computeroutput></screen>
181
[09f1daf]182 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
183 href="readjusting.xml"
184 xpointer="xpointer(//*[@os='i'])"/>
185
186 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
187 href="readjusting.xml"
188 xpointer="xpointer(//*[@os='j'])"/>
189
190 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
191 href="readjusting.xml"
192 xpointer="xpointer(//*[@os='k'])"/>
193
[e9a652b]194<screen><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
195SEARCH_DIR("/usr/local/lib")
196SEARCH_DIR("/lib")
197SEARCH_DIR("/usr/lib");</computeroutput></screen>
198
[09f1daf]199 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
200 href="readjusting.xml"
201 xpointer="xpointer(//*[@os='l'])"/>
202
203 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
204 href="readjusting.xml"
205 xpointer="xpointer(//*[@os='m'])"/>
206
207 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
208 href="readjusting.xml"
209 xpointer="xpointer(//*[@os='n'])"/>
210
211 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
212 href="readjusting.xml"
213 xpointer="xpointer(//*[@os='o'])"/>
214
215 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
216 href="readjusting.xml"
217 xpointer="xpointer(//*[@os='p'])"/>
218
219 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
220 href="readjusting.xml"
221 xpointer="xpointer(//*[@os='q'])"/>
222
223 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
224 href="readjusting.xml"
225 xpointer="xpointer(//*[@os='r'])"/>
226
227 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
228 href="readjusting.xml"
229 xpointer="xpointer(//*[@os='s'])"/>
230
231 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
232 href="readjusting.xml"
233 xpointer="xpointer(//*[@os='t'])"/>
[6a82dd9]234
[e9a652b]235 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
236 href="readjusting.xml"
237 xpointer="xpointer(//*[@os='u'])"/>
238
239 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
240 href="readjusting.xml"
241 xpointer="xpointer(//*[@os='v'])"/>
242
[6a82dd9]243 </sect2>
244
245 <sect2 id="contents-gcc" role="content">
246 <title>Contents of GCC</title>
247
248 <segmentedlist>
249 <segtitle>Installed programs</segtitle>
250 <segtitle>Installed libraries</segtitle>
251
252 <seglistitem>
253 <seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcov</seg>
[2791a8e]254 <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libmudflap.{a,so},
[9058aa1]255 libssp.{a,so}, libstdc++.{a,so}, and libsupc++.a</seg>
[6a82dd9]256 </seglistitem>
257 </segmentedlist>
258
259 <variablelist>
260 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
261 <?dbfo list-presentation="list"?>
262 <?dbhtml list-presentation="table"?>
263
[75128571]264 <varlistentry id="c">
265 <term><command>c++</command></term>
266 <listitem>
267 <para>The C++ compiler</para>
268 <indexterm zone="ch-system-gcc c">
269 <primary sortas="b-c++">c++</primary>
270 </indexterm>
271 </listitem>
272 </varlistentry>
273
[6a82dd9]274 <varlistentry id="cc">
275 <term><command>cc</command></term>
276 <listitem>
277 <para>The C compiler</para>
278 <indexterm zone="ch-system-gcc cc">
279 <primary sortas="b-cc">cc</primary>
280 </indexterm>
281 </listitem>
282 </varlistentry>
283
284 <varlistentry id="cpp">
285 <term><command>cpp</command></term>
286 <listitem>
287 <para>The C preprocessor; it is used by the compiler to expand the
288 #include, #define, and similar statements in the source files</para>
289 <indexterm zone="ch-system-gcc cpp">
290 <primary sortas="b-cpp">cpp</primary>
291 </indexterm>
292 </listitem>
293 </varlistentry>
294
295 <varlistentry id="g">
296 <term><command>g++</command></term>
297 <listitem>
298 <para>The C++ compiler</para>
299 <indexterm zone="ch-system-gcc g">
300 <primary sortas="b-g++">g++</primary>
301 </indexterm>
302 </listitem>
303 </varlistentry>
304
305 <varlistentry id="gcc">
306 <term><command>gcc</command></term>
307 <listitem>
308 <para>The C compiler</para>
309 <indexterm zone="ch-system-gcc gcc">
310 <primary sortas="b-gcc">gcc</primary>
311 </indexterm>
312 </listitem>
313 </varlistentry>
314
315 <varlistentry id="gccbug">
316 <term><command>gccbug</command></term>
317 <listitem>
318 <para>A shell script used to help create useful bug reports</para>
319 <indexterm zone="ch-system-gcc gccbug">
320 <primary sortas="b-gccbug">gccbug</primary>
321 </indexterm>
322 </listitem>
323 </varlistentry>
324
325 <varlistentry id="gcov">
326 <term><command>gcov</command></term>
327 <listitem>
328 <para>A coverage testing tool; it is used to analyze programs to
329 determine where optimizations will have the most effect</para>
330 <indexterm zone="ch-system-gcc gcov">
331 <primary sortas="b-gcov">gcov</primary>
332 </indexterm>
333 </listitem>
334 </varlistentry>
335
336 <varlistentry id="libgcc">
337 <term><filename class="libraryfile">libgcc</filename></term>
338 <listitem>
339 <para>Contains run-time support for <command>gcc</command></para>
340 <indexterm zone="ch-system-gcc libgcc">
341 <primary sortas="c-libgcc*">libgcc*</primary>
342 </indexterm>
343 </listitem>
344 </varlistentry>
345
[2791a8e]346 <varlistentry id="libmudflap">
347 <term><filename class="libraryfile">libmudflap</filename></term>
348 <listitem>
349 <para>Contains routines that support GCC's bounds checking
350 functionality</para>
351 <indexterm zone="ch-system-gcc libmudflap">
352 <primary sortas="c-libmudflap*">libmudflap*</primary>
353 </indexterm>
354 </listitem>
355 </varlistentry>
356
357 <varlistentry id="libssp">
358 <term><filename class="libraryfile">libssp</filename></term>
359 <listitem>
360 <para>Contains routines supporting GCC's stack-smashing protection
361 functionality</para>
362 <indexterm zone="ch-system-gcc libssp">
363 <primary sortas="c-libssp*">libssp*</primary>
364 </indexterm>
365 </listitem>
366 </varlistentry>
367
[6a82dd9]368 <varlistentry id="libstdc">
369 <term><filename class="libraryfile">libstdc++</filename></term>
370 <listitem>
371 <para>The standard C++ library</para>
372 <indexterm zone="ch-system-gcc libstdc">
373 <primary sortas="c-libstdc++">libstdc++</primary>
374 </indexterm>
375 </listitem>
376 </varlistentry>
377
378 <varlistentry id="libsupc">
379 <term><filename class="libraryfile">libsupc++</filename></term>
380 <listitem>
381 <para>Provides supporting routines for the C++ programming
382 language</para>
383 <indexterm zone="ch-system-gcc libsupc">
384 <primary sortas="c-libsupc++">libsupc++</primary>
385 </indexterm>
386 </listitem>
387 </varlistentry>
388
389 </variablelist>
390
391 </sect2>
[673b0d8]392
393</sect1>
Note: See TracBrowser for help on using the repository browser.