source: general/prog/gcc.xml@ 5ed7fdf

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 9.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt 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 5ed7fdf was 5ed7fdf, checked in by Pierre Labastie <pieere@…>, 4 years ago

Few tags, more SBUs...

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

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