source: chapter05/gcc-pass2.xml@ 9829329

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 9829329 was 9829329, checked in by Matthew Burgess <matthew@…>, 18 years ago

Remove optimization related warnings from the toolchain packages

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

  • Property mode set to 100644
File size: 8.6 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 <!ENTITY % patches-entities SYSTEM "../patches.ent">
5 %general-entities;
6 %patches-entities;
7]>
8<sect1 id="ch-tools-gcc-pass2" role="wrap">
9<title>GCC-&gcc-version; - Pass 2</title>
10<?dbhtml filename="gcc-pass2.html"?>
11
12<indexterm zone="ch-tools-gcc-pass2">
13<primary sortas="a-GCC">GCC</primary>
14<secondary>tools, pass 2</secondary></indexterm>
15
16<sect2 role="package"><title/>
17
18<segmentedlist>
19<segtitle>&buildtime;</segtitle>
20<segtitle>&diskspace;</segtitle>
21<seglistitem><seg>11.0 SBU</seg><seg>292 MB</seg></seglistitem>
22</segmentedlist>
23
24<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gcc.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/>
25
26</sect2>
27
28<sect2 role="installation">
29<title>Re-installation of GCC</title>
30
31<para>The tools required to test GCC and Binutils&mdash;Tcl, Expect
32and DejaGNU&mdash;are installed now. GCC and Binutils can now be
33rebuilt, linking them against the new Glibc and testing them properly
34(if running the test suites in this chapter). Please note that these
35test suites are highly dependent on properly functioning PTYs which
36are provided by the host. PTYs are most commonly implemented via the
37<systemitem class="filesystem">devpts</systemitem> file system. Check
38to see if the host system is set up correctly in this regard by
39performing a quick test:</para>
40
41<screen><userinput>expect -c "spawn ls"</userinput></screen>
42
43<para>The response might be:</para>
44
45<screen><computeroutput>The system has no more ptys.
46Ask your system administrator to create more.</computeroutput></screen>
47
48<para>If the above message is received, the host does not have its PTYs set up
49properly. In this case, there is no point in running the test suites for GCC and
50Binutils until this issue is resolved. Please consult the LFS FAQ at <ulink
51url="&lfs-root;/lfs/faq.html#no-ptys"/> for more information on how to get PTYs
52working.</para>
53
54<para>As previously explained in <xref linkend="ch-tools-adjusting"/>, under
55normal circumstances the GCC <command>fixincludes</command> script is run in
56order to fix potentially broken header files. As GCC-&gcc-version; and
57Glibc-&glibc-version; have already been installed at this point, and their
58respective header files are known to not require fixing, the
59<command>fixincludes</command> script is not required. As mentioned previously,
60the script may in fact pollute the build environment by installing fixed headers
61from the host system into GCC's private include directory. The running of the
62<command>fixincludes</command> script can be suppressed by issuing the following
63commands:</para>
64
65<screen><userinput>cp -v gcc/Makefile.in{,.orig} &amp;&amp;
66sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig &gt; gcc/Makefile.in</userinput></screen>
67
68<para>The bootstrap build performed in <xref linkend="ch-tools-gcc-pass1"/>
69built GCC with the <option>-fomit-frame-pointer</option> compiler flag.
70Non-bootstrap builds omit this flag by default, so apply the following
71<command>sed</command> to use it in order to ensure consistent compiler builds.
72</para>
73
74<screen><userinput>cp -v gcc/Makefile.in{,.tmp} &amp;&amp;
75sed 's/^XCFLAGS =$/&amp; -fomit-frame-pointer/' gcc/Makefile.in.tmp \
76 &gt; gcc/Makefile.in</userinput></screen>
77
78<para>Apply the following patch to change the location of GCC's default dynamic
79linker (typically <filename class="libraryfile">ld-linux.so.2</filename>):</para>
80
81<screen><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen>
82
83<para>The above patch also removes
84<filename class="directory">/usr/include</filename> from GCC's include search
85path. Patching now rather than adjusting the specs file after installation
86ensures that the new dynamic linker is used during the actual build of GCC. That
87is, all of the binaries created during the build will link against the new
88Glibc.</para>
89
90<important><para>The above patch is critical in ensuring a
91successful overall build. Do not forget to apply
92it.</para></important>
93
94<para>Create a separate build directory again:</para>
95
96<screen><userinput>mkdir -v ../gcc-build
97cd ../gcc-build</userinput></screen>
98
99<para>Before starting to build GCC, remember to unset any environment
100variables that override the default optimization flags.</para>
101
102<para>Now prepare GCC for compilation:</para>
103
104<screen><userinput>../gcc-&gcc-version;/configure --prefix=/tools \
105 --libexecdir=/tools/lib --with-local-prefix=/tools \
106 --enable-clocale=gnu --enable-shared \
107 --enable-threads=posix --enable-__cxa_atexit \
108 --enable-languages=c,c++ --disable-libstdcxx-pch</userinput></screen>
109
110<para>The meaning of the new configure options:</para>
111
112<variablelist>
113<varlistentry>
114<term><parameter>--enable-clocale=gnu</parameter></term>
115<listitem><para>This option ensures the correct locale model is
116selected for the C++ libraries under all circumstances. If the
117configure script finds the <emphasis>de_DE</emphasis> locale installed, it will select the
118correct gnu locale model. However, if the <emphasis>de_DE</emphasis> locale is not
119installed, there is the risk of building Application Binary Interface
120(ABI)-incompatible C++ libraries because the incorrect generic locale
121model may be selected.</para></listitem>
122</varlistentry>
123
124<varlistentry>
125<term><parameter>--enable-threads=posix</parameter></term>
126<listitem><para>This enables C++ exception handling for multi-threaded
127code.</para></listitem>
128</varlistentry>
129
130<varlistentry>
131<term><parameter>--enable-__cxa_atexit</parameter></term>
132<listitem><para>This option allows use of
133<emphasis>__cxa_atexit</emphasis>, rather than
134<emphasis>atexit</emphasis>, to register C++ destructors for local
135statics and global objects. This option is essential for fully
136standards-compliant handling of destructors. It also affects the C++
137ABI, and therefore results in C++ shared libraries and C++ programs
138that are interoperable with other Linux
139distributions.</para></listitem>
140</varlistentry>
141
142<varlistentry>
143<term><parameter>--enable-languages=c,c++</parameter></term>
144<listitem><para>This option
145ensures that both the C and C++ compilers are built.</para></listitem>
146</varlistentry>
147
148<varlistentry>
149<term><parameter>--disable-libstdcxx-pch</parameter></term>
150<listitem><para>Do not build the pre-compiled header (PCH) for
151<filename class="libraryfile">libstdc++</filename>. It takes up a lot of space,
152and we have no use for it.</para></listitem>
153</varlistentry>
154</variablelist>
155
156<para>Compile the package:</para>
157
158<screen><userinput>make</userinput></screen>
159
160<para>There is no need to use the <parameter>bootstrap</parameter>
161target now because the compiler being used to compile this GCC was
162built from the exact same version of the GCC sources used
163earlier.</para>
164
165<para>Compilation is now complete. As previously mentioned, running
166the test suites for the temporary tools compiled in this chapter is
167not mandatory. To run the GCC test suite anyway, use the following
168command:</para>
169
170<screen><userinput>make -k check</userinput></screen>
171
172<para>The <parameter>-k</parameter> flag is used to make the test suite run
173through to completion and not stop at the first failure. The GCC test
174suite is very comprehensive and is almost guaranteed to generate a few
175failures. To receive a summary of the test suite results, run:</para>
176
177<screen><userinput>../gcc-&gcc-version;/contrib/test_summary</userinput></screen>
178
179<para>For only the summaries, pipe the output through
180<userinput>grep -A7 Summ</userinput>.</para>
181
182<para>Results can be compared with those located at <ulink
183url="&test-results;"/>.</para>
184
185<para>A few unexpected failures cannot always be avoided. The GCC developers are
186usually aware of these issues, but have not resolved them yet. In particular,
187the <filename class="libraryfile">libmudflap</filename> tests are known be
188particularly problematic as a result of a bug in GCC (<ulink
189url="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20003"/>). Unless the test
190results are vastly different from those at the above URL, it is safe to
191continue.</para>
192
193<para>Install the package:</para>
194
195<screen><userinput>make install</userinput></screen>
196
197<note><para>At this point it is strongly recommended to repeat the
198sanity check we performed earlier in this chapter. Refer back to <xref
199linkend="ch-tools-adjusting" role=","/> and repeat the test compilation. If
200the result is wrong, the most likely reason is that the GCC Specs
201patch was not properly applied.</para></note>
202
203</sect2>
204
205<sect2 role="content"><title/>
206<para>Details on this package are located in <xref
207linkend="contents-gcc" role="."/></para>
208</sect2>
209
210</sect1>
211
Note: See TracBrowser for help on using the repository browser.