source: general/prog/gcc.xml@ ad86df81

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 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 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 ad86df81 was 533200f, checked in by Pierre Labastie <pieere@…>, 9 years ago

Update to gcc-4.9.2

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

  • Property mode set to 100644
File size: 13.0 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 "4df8ee253b7f3863ad0b86359cd39c43">
10 <!ENTITY gcc-size "86 MB">
11 <!ENTITY gcc-buildsize "5.2 GB">
12 <!ENTITY gcc-time "138 SBU (including 95 SBU for tests)">
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
91 <bridgehead renderas="sect3">GCC Dependencies</bridgehead>
92
93 <bridgehead renderas="sect4">Recommended</bridgehead>
94 <para role="recommended">
95 <xref linkend="dejagnu"/>, for tests
96 </para>
97
98 <para condition="html" role="usernotes">User Notes:
99 <ulink url="&blfs-wiki;/gcc"/></para>
100
101 </sect2>
102
103 <sect2 role="installation">
104 <title>Installation of GCC</title>
105
106 <important>
107 <para>Even if you specify only languages other than C and C++ to the
108 <command>./configure</command> command below, the
109 installation process will overwrite your existing
110 <application>GCC</application> C and C++ compilers and libraries.
111 Having the <application>Tcl</application>,
112 <application>Expect</application> and <application>DejaGnu</application>
113 packages installed before beginning the build is highly recommended so
114 you can run the full suite of tests.</para>
115
116 <para>Do not continue with the <command>make install</command> command
117 until you are confident the build was successful. You can compare your
118 test results with those found at <ulink
119 url="http://gcc.gnu.org/ml/gcc-testresults/"/>. You may also want to
120 refer to the information found in the <application>GCC</application>
121 section of Chapter 6 in the LFS book (<ulink
122 url="&lfs-root;/chapter06/gcc.html"/>).</para>
123 </important>
124
125 <para>The instructions below are intentionally performing a
126 <quote>bootstrap</quote> process. Bootstrapping is needed for robustness
127 and is highly recommended when upgrading the compilers version. To disable
128 bootstrap anyways, add <parameter>--disable-bootstrap</parameter> to the
129 <command>./configure</command> options below.</para>
130<!--
131 <para>As in LFS, fix a problem identified upstream:</para>
132
133<screen><userinput>sed -i 's/if \((code.*))\)/if (\1 \&amp;\&amp; \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>
134-->
135
136 <para>Install <application>GCC</application> by running the
137 following commands:</para>
138
139<screen><userinput><!--
140patch -Np1 -i ../gcc-&gcc-version;-upstream_fixes-1.patch &amp;&amp;
141-->mkdir ../gcc-build &amp;&amp;
142cd ../gcc-build &amp;&amp;
143
144../gcc-&gcc-version;/configure \
145 --prefix=/usr \
146 --libdir=/usr/lib \
147 --enable-shared \
148 --enable-threads=posix \
149 --enable-__cxa_atexit \
150 --enable-clocale=gnu \
151 --disable-multilib \
152 --with-system-zlib \
153 --enable-languages=c,c++,fortran,go,objc,obj-c++ &amp;&amp;
154make</userinput></screen>
155
156 <para>If you have installed additional packages such as
157 <application>Valgrind</application> and <application>GDB</application>,
158 the <application>GCC</application> part of the testsuite will run more
159 tests than in LFS. Some of those will report FAIL and others XPASS
160 (pass when expected to FAIL). To run the tests, issue:</para>
161
162<screen><userinput>ulimit -s 32768 &amp;&amp;
163make -k check</userinput></screen>
164<!-- The command above may error out, so using && may prevent the summary
165to be run. -->
166
167 <para>The tests are very long, and the results may be hard to find in the
168 logs, specially if you use parallel jobs with make. You can get a summary
169 of the tests with:</para>
170
171<screen><userinput>../gcc-&gcc-version;/contrib/test_summary</userinput></screen>
172
173 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
174
175<screen role="root"><userinput>make install &amp;&amp;
176
177mkdir -pv /usr/share/gdb/auto-load/usr/lib &amp;&amp;
178mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib &amp;&amp;
179
180chown -v -R root:root \
181 /usr/lib/gcc/*linux-gnu/&gcc-version;/include{,-fixed}</userinput></screen>
182
183 <para>Some packages expect to find the C preprocessor in
184 <filename class="directory">/lib</filename> or may refer to the C compiler
185 under the name <command>cc</command>. The following symbolic links are not
186 needed if you have followed the LFS instructions, since they
187 have been already created. If you do not have them on your system, issue
188 as the <systemitem class="username">root</systemitem> user:</para>
189
190<screen role="root"><userinput>ln -v -sf ../usr/bin/cpp /lib &amp;&amp;
191ln -v -sf gcc /usr/bin/cc</userinput></screen>
192
193 </sect2>
194
195 <sect2 role="commands">
196 <title>Command Explanations</title>
197<!--
198 <para>
199 <command>patch ... gcc-&gcc-version;-upstream_fixes-1.patch</command>:
200 This patch corrects bugs in the C++ compiler, which lead to
201 segmentation faults in some cases.
202 </para>
203-->
204
205 <para>
206 <command>mkdir ../gcc-build; cd ../gcc-build</command>: The
207 <application>GCC</application> documentation recommends
208 building the package in a dedicated build directory.
209 </para>
210
211 <para>
212 <parameter>--enable-shared --enable-threads=posix
213 --enable-__cxa_atexit</parameter>: These parameters are required to build
214 the <application>C++</application> libraries to published standards.
215 </para>
216
217 <para>
218 <parameter>--enable-clocale=gnu</parameter>: This parameter is a
219 failsafe for incomplete locale data.</para>
220
221 <para>
222 <parameter>--disable-multilib</parameter>: This parameter ensures
223 that files are created for the specific architecture of your computer.
224 </para>
225
226 <para>
227 <parameter>--with-system-zlib</parameter>: Uses the system
228 <application>zlib</application> instead of the bundled one.
229 <application>zlib</application> is used for compressing
230 and uncompressing <application>GCC</application>'s intermediate
231 language in LTO (Link Time Optimization) object files.
232 </para>
233
234 <para>
235 <parameter>--enable-languages=c,c++,fortran,go,objc,obj-c++</parameter>:
236 This command identifies which languages to build. You may modify
237 this command to remove undesired languages.
238 </para>
239
240 <para>
241 <command>ulimit -s 32768</command>: This command prevents several
242 tests from running out of stack space.
243 </para>
244
245 <para>
246 <command>make -k check</command>: This command runs the test suite
247 without stopping if any errors are encountered.
248 </para>
249
250 <para>
251 <command>../gcc-&gcc-version;/contrib/test_summary</command>: This
252 command will produce a summary of the test suite results. You can append
253 <command>| grep -A7 Summ</command> to the command to produce an even more
254 condensed version of the summary. You may also wish to redirect the output
255 to a file for review and comparison later on.
256 </para>
257
258 <para>
259 <command>mv -v /usr/lib/*gdb.py ...</command>: The installation
260 stage puts some files used by <application>gdb</application> under the
261 <filename class="directory">/usr/lib</filename> directory. This generates
262 spurious error messages when performing <command>ldconfig</command>. This
263 command moves the files to another location.
264 </para>
265
266 <para>
267 <command>chown -v -R root:root /usr/lib/gcc/*linux-gnu/...</command>:
268 If the package is built by a user other than root, the ownership of the
269 installed <filename class="directory">include</filename> directory (and
270 its content) will be incorrect. This command changes the ownership to the
271 <systemitem class="username">root</systemitem> user and group.
272 </para>
273
274 </sect2>
275
276 <sect2 role="content">
277 <title>Contents</title>
278
279 <para>Some program and library names and descriptions are not listed here,
280 but can be found at
281 <ulink url="&lfs-root;/chapter06/gcc.html#contents-gcc"/> as they were
282 initially installed during the building of LFS.</para>
283
284 <segmentedlist>
285 <segtitle>Installed Programs</segtitle>
286 <segtitle>Installed Libraries</segtitle>
287 <segtitle>Installed Directories</segtitle>
288
289 <seglistitem>
290 <seg>
291 gccgo and gfortran,
292 hard-linked to architecture specific names
293 </seg>
294 <seg>
295 libgfortran.{so,a},
296 libgo.{so,a}, libgobegin.a, libobjc.{so,a}, and numerous other
297 run-time libraries and executables in <filename class="directory">
298 /usr/lib/gcc</filename>, <filename class="directory">
299 /usr/libexec/gcc</filename>, and <filename class="directory">
300 /usr/lib/go</filename>
301 </seg>
302 <seg>
303 /usr/lib/gcc/&lt;arch-triplet&gt;/&gcc-version;/include/objc and
304 /usr/lib/go
305 </seg>
306 </seglistitem>
307 </segmentedlist>
308
309 <variablelist>
310 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
311 <?dbfo list-presentation="list"?>
312 <?dbhtml list-presentation="table"?>
313
314 <varlistentry id="gccgo">
315 <term><command>gccgo</command></term>
316 <listitem>
317 <para>is a GCC-based compiler for the
318 <application>Go</application> language.</para>
319 <indexterm zone="gcc gccgo">
320 <primary sortas="b-gccgo">gccgo</primary>
321 </indexterm>
322 </listitem>
323 </varlistentry>
324
325 <varlistentry id="gfortran">
326 <term><command>gfortran</command></term>
327 <listitem>
328 <para>is a GCC-based compiler for the
329 <application>Fortran</application> language.</para>
330 <indexterm zone="gcc gfortran">
331 <primary sortas="b-gfortran">gfortran</primary>
332 </indexterm>
333 </listitem>
334 </varlistentry>
335
336 </variablelist>
337
338 </sect2>
339
340</sect1>
Note: See TracBrowser for help on using the repository browser.