source: general/prog/gcc.xml@ 9562b375

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

GCC-7.1.0; archive gcc-java, since
it is not anymore in the GCC sources

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

  • Property mode set to 100644
File size: 14.4 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://ftpmirror.gnu.org/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 "6bf56a2bca9dac9dbbf8e8d1036964a8">
10 <!ENTITY gcc-size "80 MB">
11 <!ENTITY gcc-buildsize "7.4 GB (with tests)">
12 <!ENTITY gcc-time "61 SBU (with tests and parallelism=4)">
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-5-0">GCC-&gcc-version;</primary>
27 </indexterm>
28
29 <sect2 role="package">
30 <title>Introduction to GCC</title>
31
32 <para>
33 The <application>GCC</application> package contains the GNU Compiler
34 Collection. This page describes the installation of compilers for the
35 following languages: C, C++, Fortran, Objective C, Objective C++, and Go.
36 One additional languages , Ada is available in the collection. It has
37 specific requirements, so it is described in a separate page (<xref
38 linkend="gcc-ada"/>). Since C and C++ are installed in LFS, this page is
39 either for upgrading C and C++, or for installing additional compilers.
40 </para>
41
42 &lfs80_checked;
43
44 <caution>
45 <para>
46 If you are upgrading <application>GCC</application> from any other
47 version prior to &gcc-version;, then you must be careful compiling 3rd
48 party kernel modules. You should ensure that the kernel and all its
49 native modules are also compiled using the same version of
50 <application>GCC</application> that you use to build the 3rd party module.
51 This issue does not affect native kernel (and kernel modules) updates,
52 as the instructions below are a complete reinstallation of
53 <application>GCC</application>. If you have existing 3rd party modules
54 installed, ensure they are recompiled using the updated version of
55 <application>GCC</application>. As always, never update the kernel
56 headers from the ones used when <application>Glibc</application> was
57 compiled during LFS.
58 </para>
59
60 <para>
61 The 5.1.0 version of GCC introduces an incompatible ABI change in the
62 C++ library <filename>libstdc++.so</filename>. This does not prevent
63 using programs compiled with the previous version of <application>GCC
64 </application>, since both old and new symbols are available in the
65 library. But compiling, with the new version, programs which use
66 libraries compiled with the old version is likely to give errors. So,
67 if you are upgrading from any previous version prior to 5.1.0, you have
68 two solutions:
69 recompile all the libraries with the new version, or use the <option>
70 --with-default-libstdcxx-abi</option> switch to configure.
71 </para>
72 </caution>
73
74 <bridgehead renderas="sect3">Package Information</bridgehead>
75 <itemizedlist spacing="compact">
76 <listitem>
77 <para>
78 Download (HTTP): <ulink url="&gcc-download-http;"/>
79 </para>
80 </listitem>
81 <listitem>
82 <para>
83 Download (FTP): <ulink url="&gcc-download-ftp;"/>
84 </para>
85 </listitem>
86 <listitem>
87 <para>
88 Download MD5 sum: &gcc-md5sum;
89 </para>
90 </listitem>
91 <listitem>
92 <para>
93 Download size: &gcc-size;
94 </para>
95 </listitem>
96 <listitem>
97 <para>
98 Estimated disk space required: &gcc-buildsize;
99 </para>
100 </listitem>
101 <listitem>
102 <para>
103 Estimated build time: &gcc-time;
104 </para>
105 </listitem>
106 </itemizedlist>
107
108<!-- <bridgehead renderas="sect3">Additional Downloads</bridgehead>
109 <itemizedlist spacing="compact">
110 <listitem>
111 <para>
112 Required patch:
113 <ulink url="&patch-root;/gcc-&gcc-version;-upstream_fixes-1.patch"/>
114 </para>
115 </listitem>
116 </itemizedlist>
117-->
118
119 <bridgehead renderas="sect3">GCC Dependencies</bridgehead>
120
121 <bridgehead renderas="sect4">Recommended</bridgehead>
122 <para role="recommended">
123 <xref linkend="dejagnu"/>, for tests
124 </para>
125
126 <para condition="html" role="usernotes">
127 User Notes: <ulink url="&blfs-wiki;/gcc"/>
128 </para>
129
130 </sect2>
131
132 <sect2 role="installation">
133 <title>Installation of GCC</title>
134
135 <important>
136 <para>
137 Even if you specify only languages other than C and C++ to the
138 <command>./configure</command> command below, the
139 installation process will overwrite your existing
140 <application>GCC</application> C and C++ compilers and libraries.
141 Having the <application>Tcl</application>,
142 <application>Expect</application> and <application>DejaGnu</application>
143 packages installed before beginning the build is highly recommended so
144 you can run the full suite of tests.
145 </para>
146
147 <para>
148 Do not continue with the <command>make install</command> command
149 until you are confident the build was successful. You can compare your
150 test results with those found at <ulink
151 url="http://gcc.gnu.org/ml/gcc-testresults/"/>. You may also want to
152 refer to the information found in the <application>GCC</application>
153 section of Chapter 6 in the LFS book (<ulink
154 url="&lfs-root;/chapter06/gcc.html"/>).
155 </para>
156 </important>
157
158 <para>
159 The instructions below are intentionally performing a
160 <quote>bootstrap</quote> process. Bootstrapping is needed for robustness
161 and is highly recommended when upgrading the compilers version. To disable
162 bootstrap anyways, add <parameter>--disable-bootstrap</parameter> to the
163 <command>./configure</command> options below.
164 </para>
165
166 <para>
167 Install <application>GCC</application> by running the following commands:
168 </para>
169
170<screen><userinput>case $(uname -m) in
171 x86_64)
172 sed -e '/m64=/s/lib64/lib/' \
173 -i.orig gcc/config/i386/t-linux64
174 ;;
175esac
176
177mkdir build &amp;&amp;
178cd build &amp;&amp;
179
180../configure \
181 --prefix=/usr \
182 --disable-multilib \
183 --with-system-zlib \
184 --enable-languages=c,c++,fortran,go,objc,obj-c++ &amp;&amp;
185make</userinput></screen>
186
187 <para>
188 If you have installed additional packages such as
189 <application>Valgrind</application> and <application>GDB</application>,
190 the <application>GCC</application> part of the testsuite will run more
191 tests than in LFS. Some of those will report FAIL and others XPASS
192 (pass when expected to FAIL). To run the tests, issue:
193 </para>
194
195<screen><userinput>ulimit -s 32768 &amp;&amp;
196make -k check</userinput></screen>
197<!-- The command above may error out, so using && may prevent the summary
198to be run. -->
199
200 <para>
201 The tests are very long, and the results may be hard to find in the
202 logs, specially if you use parallel jobs with make. You can get a summary
203 of the tests with:
204 </para>
205
206<screen><userinput>../contrib/test_summary</userinput></screen>
207
208 <para>
209 Now, as the <systemitem class="username">root</systemitem> user:
210 </para>
211
212<screen role="root"><userinput>make install &amp;&amp;
213
214mkdir -pv /usr/share/gdb/auto-load/usr/lib &amp;&amp;
215mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib &amp;&amp;
216
217chown -v -R root:root \
218 /usr/lib/gcc/*linux-gnu/&gcc-version;/include{,-fixed}</userinput></screen>
219
220 <para>
221 Some packages expect to find the C preprocessor in
222 <filename class="directory">/lib</filename> or may refer to the C compiler
223 under the name <command>cc</command>. The following symbolic links are not
224 needed if you have followed the LFS instructions, since they
225 have been already created. If you do not have them on your system, issue
226 as the <systemitem class="username">root</systemitem> user:
227 </para>
228
229<screen role="root"><userinput>ln -v -sf ../usr/bin/cpp /lib &amp;&amp;
230ln -v -sf gcc /usr/bin/cc &amp;&amp;
231install -v -dm755 /usr/lib/bfd-plugins &amp;&amp;
232ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/&gcc-version;/liblto_plugin.so /usr/lib/bfd-plugins/</userinput></screen>
233
234 </sect2>
235
236 <sect2 role="commands">
237 <title>Command Explanations</title>
238
239 <para>
240 <command>mkdir build; cd build</command>: The
241 <application>GCC</application> documentation recommends
242 building the package in a dedicated build directory.
243 </para>
244
245 <para>
246 <parameter>--disable-multilib</parameter>: This parameter ensures
247 that files are created for the specific architecture of your computer.
248 </para>
249
250 <para>
251 <parameter>--with-system-zlib</parameter>: Uses the system
252 <application>zlib</application> instead of the bundled one.
253 <application>zlib</application> is used for compressing
254 and uncompressing <application>GCC</application>'s intermediate
255 language in LTO (Link Time Optimization) object files.
256 </para>
257
258 <para>
259 <parameter>--enable-languages=c,c++,fortran,go,objc,obj-c++</parameter>:
260 This command identifies which languages to build. You may modify
261 this command to remove undesired languages. Two other languages can be
262 added, besides ADA, which is described on a separate page: BRIG, a binary
263 format for HSAIL (Heterogeneous System Architecture Intermediate
264 Language), and JIT, a library which can be linked into interpreters that
265 want to generate machine code <quote>on the fly</quote> at run-time. They
266 have not been tested by the BLFS developpers.
267 </para>
268
269 <para>
270 <option>--with-default-libstdcxx-abi=gcc4-compatible</option>: Use this
271 switch if you are upgrading from a <application>GCC</application>
272 version prior to 5.1.0, and you do not want to recompile all the
273 libraries written in C++.
274 </para>
275
276 <para>
277 <command>ulimit -s 32768</command>: This command prevents several
278 tests from running out of stack space.
279 </para>
280
281 <para>
282 <command>make -k check</command>: This command runs the test suite
283 without stopping if any errors are encountered.
284 </para>
285
286 <para>
287 <command>../contrib/test_summary</command>: This command will produce
288 a summary of the test suite results. You can append <command>| grep
289 -A7 Summ</command> to the command to produce an even more condensed
290 version of the summary. You may also wish to redirect the output
291 to a file for review and comparison later on.
292 </para>
293
294 <para>
295 <command>mv -v /usr/lib/*gdb.py ...</command>: The installation
296 stage puts some files used by <application>gdb</application> under the
297 <filename class="directory">/usr/lib</filename> directory. This generates
298 spurious error messages when performing <command>ldconfig</command>. This
299 command moves the files to another location.
300 </para>
301
302 <para>
303 <command>chown -v -R root:root /usr/lib/gcc/*linux-gnu/...</command>:
304 If the package is built by a user other than root, the ownership of the
305 installed <filename class="directory">include</filename> directory (and
306 its content) will be incorrect. This command changes the ownership to the
307 <systemitem class="username">root</systemitem> user and group.
308 </para>
309
310 </sect2>
311
312 <sect2 role="content">
313 <title>Contents</title>
314
315 <para>
316 Some program and library names and descriptions are not listed here,
317 but can be found at
318 <ulink url="&lfs-root;/chapter06/gcc.html#contents-gcc"/> as they were
319 initially installed during the building of LFS.
320 </para>
321
322 <segmentedlist>
323 <segtitle>Installed Programs</segtitle>
324 <segtitle>Installed Libraries</segtitle>
325 <segtitle>Installed Directories</segtitle>
326
327 <seglistitem>
328 <seg>
329 gccgo, go, gofmt and gfortran, hard-linked to architecture specific
330 names
331 </seg>
332 <seg>
333 libgfortran.{so,a},
334 libgo.{so,a}, libgobegin.a, libgolibbegin.a,
335 libobjc.{so,a}, and numerous other run-time libraries and executables
336 </seg>
337 <seg>
338 /usr/lib/go/&gcc-version;
339 </seg>
340 </seglistitem>
341 </segmentedlist>
342
343 <variablelist>
344 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
345 <?dbfo list-presentation="list"?>
346 <?dbhtml list-presentation="table"?>
347
348 <varlistentry id="gccgo">
349 <term><command>gccgo</command></term>
350 <listitem>
351 <para>
352 is a GCC-based compiler for the <application>Go</application>
353 language.
354 </para>
355 <indexterm zone="gcc gccgo">
356 <primary sortas="b-gccgo">gccgo</primary>
357 </indexterm>
358 </listitem>
359 </varlistentry>
360
361 <varlistentry id="go">
362 <term><command>go</command></term>
363 <listitem>
364 <para>
365 is a tool for managing <application>Go</application> source code.
366 </para>
367 <indexterm zone="gcc go">
368 <primary sortas="b-go">go</primary>
369 </indexterm>
370 </listitem>
371 </varlistentry>
372
373 <varlistentry id="gofmt">
374 <term><command>gofmt</command></term>
375 <listitem>
376 <para>
377 is a tool for formatting <application>Go</application> source code.
378 </para>
379 <indexterm zone="gcc gofmt">
380 <primary sortas="b-gofmt">gofmt</primary>
381 </indexterm>
382 </listitem>
383 </varlistentry>
384
385 <varlistentry id="gfortran">
386 <term><command>gfortran</command></term>
387 <listitem>
388 <para>
389 is a GCC-based compiler for the <application>Fortran</application>
390 language.
391 </para>
392 <indexterm zone="gcc gfortran">
393 <primary sortas="b-gfortran">gfortran</primary>
394 </indexterm>
395 </listitem>
396 </varlistentry>
397
398 </variablelist>
399
400 </sect2>
401
402</sect1>
Note: See TracBrowser for help on using the repository browser.