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

11.0 11.1 11.2 11.3 12.0 12.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 8f58378e was 8f58378e, checked in by Ken Moffat <ken@…>, 3 years ago

GCC - apply the same patch as in LFS.

Also update the summary of unexpected failures.

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