source: general/prog/gcc.xml@ 2d488eb

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 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 systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 2d488eb was 2d488eb, checked in by Pierre Labastie <pieere@…>, 10 years ago

Split GCC pages. See rationale on ticket # 5000

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

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