source: general/prog/gcc.xml@ 8ddc247

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 8ddc247 was 8ddc247, checked in by Pierre Labastie <pieere@…>, 10 years ago

Add upstream fixes patch to GCC pages and tag them

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@14307 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 12.9 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 <!ENTITY gcc-download-http "http://ftp.gnu.org/gnu/gcc/gcc-&gcc-version;/gcc-&gcc-version;.tar.bz2">
8 <!ENTITY gcc-download-ftp "ftp://ftp.gnu.org/gnu/gcc/gcc-&gcc-version;/gcc-&gcc-version;.tar.bz2">
9 <!ENTITY gcc-md5sum "fddf71348546af523353bd43d34919c1">
10 <!ENTITY gcc-size "86 MB">
11 <!ENTITY gcc-buildsize "5.1 GB">
12 <!ENTITY gcc-time "145 SBU">
13]>
14
15<sect1 id="gcc" xreflabel="GCC-&gcc-version;">
16 <?dbhtml filename="gcc.html" ?>
17
18 <sect1info>
19 <othername>$LastChangedBy$</othername>
20 <date>$Date$</date>
21 </sect1info>
22
23 <title>GCC-&gcc-version;</title>
24
25 <indexterm zone="gcc">
26 <primary sortas="a-gcc-4-0">GCC-&gcc-version;</primary>
27 </indexterm>
28
29 <sect2 role="package">
30 <title>Introduction to GCC</title>
31
32 <para>The <application>GCC</application> package contains the GNU Compiler
33 Collection. This page describes the installation of compilers for the
34 following languages: C, C++, Fortran, Objective C, Objective C++, and Go.
35 Two additional languages , Ada and Java are available in the collection.
36 They have specific requirements, so they are described in separate pages
37 (<xref linkend="gcc-ada"/> and <xref linkend="gcc-java"/>). Since C and
38 C++ are installed in LFS, this page is either for upgrading C and C++,
39 or for installing additional compilers.</para>
40
41 &lfs76_checked;
42
43 <caution>
44 <para>If you are upgrading <application>GCC</application> from any other
45 version prior to &gcc-version;, then you must be careful compiling 3rd
46 party kernel modules. You should ensure that the kernel and all its
47 native modules are also compiled using the same version of
48 <application>GCC</application> that you use to build the 3rd party module.
49 This issue does not affect native kernel (and kernel modules) updates,
50 as the instructions below are a complete reinstallation of
51 <application>GCC</application>. If you have existing 3rd party modules
52 installed, ensure they are recompiled using the updated version of
53 <application>GCC</application>. As always, never update the kernel
54 headers from the ones used when <application>Glibc</application> was
55 compiled during LFS.</para>
56 </caution>
57
58 <bridgehead renderas="sect3">Package Information</bridgehead>
59 <itemizedlist spacing="compact">
60 <listitem>
61 <para>Download (HTTP): <ulink url="&gcc-download-http;"/></para>
62 </listitem>
63 <listitem>
64 <para>Download (FTP): <ulink url="&gcc-download-ftp;"/></para>
65 </listitem>
66 <listitem>
67 <para>Download MD5 sum: &gcc-md5sum;</para>
68 </listitem>
69 <listitem>
70 <para>Download size: &gcc-size;</para>
71 </listitem>
72 <listitem>
73 <para>Estimated disk space required: &gcc-buildsize;</para>
74 </listitem>
75 <listitem>
76 <para>Estimated build time: &gcc-time;</para>
77 </listitem>
78 </itemizedlist>
79
80 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
81 <itemizedlist spacing="compact">
82 <listitem>
83 <para>
84 Required patch:
85 <ulink url="&patch-root;/gcc-&gcc-version;-upstream_fixes-1.patch"/>
86 </para>
87 </listitem>
88 </itemizedlist>
89
90 <bridgehead renderas="sect3">GCC Dependencies</bridgehead>
91
92 <bridgehead renderas="sect4">Recommended</bridgehead>
93 <para role="recommended">
94 <xref linkend="dejagnu"/>, for tests
95 </para>
96
97 <para condition="html" role="usernotes">User Notes:
98 <ulink url="&blfs-wiki;/gcc"/></para>
99
100 </sect2>
101
102 <sect2 role="installation">
103 <title>Installation of GCC</title>
104
105 <important>
106 <para>Even if you specify only languages other than C and C++ to the
107 <command>./configure</command> command below, the
108 installation process will overwrite your existing
109 <application>GCC</application> C and C++ compilers and libraries.
110 Having the <application>Tcl</application>,
111 <application>Expect</application> and <application>DejaGnu</application>
112 packages installed before beginning the build is highly recommended so
113 you can run the full suite of tests.</para>
114
115 <para>Do not continue with the <command>make install</command> command
116 until you are confident the build was successful. You can compare your
117 test results with those found at <ulink
118 url="http://gcc.gnu.org/ml/gcc-testresults/"/>. You may also want to
119 refer to the information found in the <application>GCC</application>
120 section of Chapter 6 in the LFS book (<ulink
121 url="&lfs-root;/chapter06/gcc.html"/>).</para>
122 </important>
123
124 <para>The instructions below are intentionally performing a
125 <quote>bootstrap</quote> process. Bootstrapping is needed for robustness
126 and is highly recommended when upgrading the compilers version. To disable
127 bootstrap anyways, add <parameter>--disable-bootstrap</parameter> to the
128 <command>./configure</command> options below.</para>
129
130 <para>As in LFS, fix a problem identified upstream:</para>
131
132<screen><userinput>sed -i 's/if \((code.*))\)/if (\1 \&amp;\&amp; \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>
133
134 <para>Install <application>GCC</application> by running the
135 following commands:</para>
136
137<screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-upstream_fixes-1.patch &amp;&amp;
138mkdir ../gcc-build &amp;&amp;
139cd ../gcc-build &amp;&amp;
140
141../gcc-&gcc-version;/configure \
142 --prefix=/usr \
143 --libdir=/usr/lib \
144 --enable-shared \
145 --enable-threads=posix \
146 --enable-__cxa_atexit \
147 --enable-clocale=gnu \
148 --disable-multilib \
149 --with-system-zlib \
150 --enable-languages=c,c++,fortran,go,objc,obj-c++ &amp;&amp;
151make</userinput></screen>
152
153 <para>If you have installed additional packages such as
154 <application>Valgrind</application> and <application>GDB</application>,
155 the <application>GCC</application> part of the testsuite will run more
156 tests than in LFS. Some of those will report FAIL and others XPASS
157 (pass when expected to FAIL). To run the tests, issue:</para>
158
159<screen><userinput>ulimit -s 32768 &amp;&amp;
160make -k check</userinput></screen>
161<!-- The command above may error out, so using && may prevent the summary
162to be run. -->
163
164 <para>The tests are very long, and the results may be hard to find in the
165 logs, specially if you use parallel jobs with make. You can get a summary
166 of the tests with:</para>
167
168<screen><userinput>../gcc-&gcc-version;/contrib/test_summary</userinput></screen>
169
170 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
171
172<screen role="root"><userinput>make install &amp;&amp;
173
174mkdir -pv /usr/share/gdb/auto-load/usr/lib &amp;&amp;
175mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib &amp;&amp;
176
177chown -v -R root:root \
178 /usr/lib/gcc/*linux-gnu/&gcc-version;/include{,-fixed}</userinput></screen>
179
180 <para>Some packages expect to find the C preprocessor in
181 <filename class="directory">/lib</filename> or may refer to the C compiler
182 under the name <command>cc</command>. The following symbolic links are not
183 needed if you have followed the LFS instructions, since they
184 have been already created. If you do not have them on your system, issue
185 as the <systemitem class="username">root</systemitem> user:</para>
186
187<screen role="root"><userinput>ln -v -sf ../usr/bin/cpp /lib &amp;&amp;
188ln -v -sf gcc /usr/bin/cc</userinput></screen>
189
190 </sect2>
191
192 <sect2 role="commands">
193 <title>Command Explanations</title>
194
195 <para>
196 <command>patch ... gcc-&gcc-version;-upstream_fixes-1.patch</command>:
197 This patch corrects bugs in the C++ compiler, which lead to
198 segmentation faults in some cases.
199 </para>
200
201 <para>
202 <command>mkdir ../gcc-build; cd ../gcc-build</command>: The
203 <application>GCC</application> documentation recommends
204 building the package in a dedicated build directory.
205 </para>
206
207 <para>
208 <parameter>--enable-shared --enable-threads=posix
209 --enable-__cxa_atexit</parameter>: These parameters are required to build
210 the <application>C++</application> libraries to published standards.
211 </para>
212
213 <para>
214 <parameter>--enable-clocale=gnu</parameter>: This parameter is a
215 failsafe for incomplete locale data.</para>
216
217 <para>
218 <parameter>--disable-multilib</parameter>: This parameter ensures
219 that files are created for the specific architecture of your computer.
220 </para>
221
222 <para>
223 <parameter>--with-system-zlib</parameter>: Uses the system
224 <application>zlib</application> instead of the bundled one.
225 <application>zlib</application> is used for compressing
226 and uncompressing <application>GCC</application>'s intermediate
227 language in LTO (Link Time Optimization) object files.
228 </para>
229
230 <para>
231 <parameter>--enable-languages=c,c++,fortran,go,objc,obj-c++</parameter>:
232 This command identifies which languages to build. You may modify
233 this command to remove undesired languages.
234 </para>
235
236 <para>
237 <command>ulimit -s 32768</command>: This command prevents several
238 tests from running out of stack space.
239 </para>
240
241 <para>
242 <command>make -k check</command>: This command runs the test suite
243 without stopping if any errors are encountered.
244 </para>
245
246 <para>
247 <command>../gcc-&gcc-version;/contrib/test_summary</command>: This
248 command will produce a summary of the test suite results. You can append
249 <command>| grep -A7 Summ</command> to the command to produce an even more
250 condensed version of the summary. You may also wish to redirect the output
251 to a file for review and comparison later on.
252 </para>
253
254 <para>
255 <command>mv -v /usr/lib/*gdb.py ...</command>: The installation
256 stage puts some files used by <application>gdb</application> under the
257 <filename class="directory">/usr/lib</filename> directory. This generates
258 spurious error messages when performing <command>ldconfig</command>. This
259 command moves the files to another location.
260 </para>
261
262 <para>
263 <command>chown -v -R root:root /usr/lib/gcc/*linux-gnu/...</command>:
264 If the package is built by a user other than root, the ownership of the
265 installed <filename class="directory">include</filename> directory (and
266 its content) will be incorrect. This command changes the ownership to the
267 <systemitem class="username">root</systemitem> user and group.
268 </para>
269
270 </sect2>
271
272 <sect2 role="content">
273 <title>Contents</title>
274
275 <para>Some program and library names and descriptions are not listed here,
276 but can be found at
277 <ulink url="&lfs-root;/chapter06/gcc.html#contents-gcc"/> as they were
278 initially installed during the building of LFS.</para>
279
280 <segmentedlist>
281 <segtitle>Installed Programs</segtitle>
282 <segtitle>Installed Libraries</segtitle>
283 <segtitle>Installed Directories</segtitle>
284
285 <seglistitem>
286 <seg>
287 gccgo and gfortran,
288 hard-linked to architecture specific names
289 </seg>
290 <seg>
291 libgfortran.{so,a},
292 libgo.{so,a}, libgobegin.a, libobjc.{so,a}, and numerous other
293 run-time libraries and executables in <filename class="directory">
294 /usr/lib/gcc</filename> and <filename class="directory">
295 /usr/libexec/gcc</filename>
296 </seg>
297 <seg>
298 /usr/lib/gcc/&lt;arch-triplet&gt;/&gcc-version;/include/objc and
299 /usr/lib/go
300 </seg>
301 </seglistitem>
302 </segmentedlist>
303
304 <variablelist>
305 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
306 <?dbfo list-presentation="list"?>
307 <?dbhtml list-presentation="table"?>
308
309 <varlistentry id="gccgo">
310 <term><command>gccgo</command></term>
311 <listitem>
312 <para>is a GCC-based compiler for the
313 <application>Go</application> language.</para>
314 <indexterm zone="gcc gccgo">
315 <primary sortas="b-gccgo">gccgo</primary>
316 </indexterm>
317 </listitem>
318 </varlistentry>
319
320 <varlistentry id="gfortran">
321 <term><command>gfortran</command></term>
322 <listitem>
323 <para>is a GCC-based compiler for the
324 <application>Fortran</application> language.</para>
325 <indexterm zone="gcc gfortran">
326 <primary sortas="b-gfortran">gfortran</primary>
327 </indexterm>
328 </listitem>
329 </varlistentry>
330
331 </variablelist>
332
333 </sect2>
334
335</sect1>
Note: See TracBrowser for help on using the repository browser.