source: general/prog/gcc.xml@ 7354b9a

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 xry111/llvm18 xry111/soup3 xry111/xf86-video-removal
Last change on this file since 7354b9a was 7354b9a, checked in by Pierre Labastie <pierre.labastie@…>, 2 years ago

Update to gcc-12.1.0

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