source: general/prog/gcc.xml@ 12ab2eb

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 12ab2eb was 12ab2eb, checked in by Pierre Labastie <pierre.labastie@…>, 20 months ago

Apply glibc-2.36 patch to BLFS gcc

  • Property mode set to 100644
File size: 15.8 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 <!-- Update this also on the grub-uefi page -->
10 <!ENTITY gcc-md5sum "ed45b55ee859ada4b25a1e76e0c4d966">
11 <!ENTITY gcc-size "79 MB">
12 <!ENTITY gcc-buildsize "10.5 GB (2.4 GB installed with all listed languages; add 1.3 GB for tests)">
13 <!-- For me the SBU values are a bit faster on haswell, but much slower on ryzen 3400G,
14 so keeping these existing values as an approximation - ken -->
15 <!ENTITY gcc-time "31 SBU (add 67 SBU for tests; both with parallelism=4)">
16]>
17
18<sect1 id="gcc" xreflabel="GCC-&gcc-version;">
19 <?dbhtml filename="gcc.html" ?>
20
21 <sect1info>
22 <date>$Date$</date>
23 </sect1info>
24
25 <title>GCC-&gcc-version;</title>
26
27 <indexterm zone="gcc">
28 <primary sortas="a-gcc-5-0">GCC-&gcc-version;</primary>
29 </indexterm>
30
31 <sect2 role="package">
32 <title>Introduction to GCC</title>
33
34 <para>
35 The <application>GCC</application> package contains the GNU Compiler
36 Collection. This page describes the installation of compilers for the
37 following languages: C, C++, Fortran, Objective C, Objective C++, and Go.
38 Since C and C++ are installed in LFS, this page is either for upgrading
39 C and C++, or for installing additional compilers.
40 </para>
41
42 <note>
43 <para>
44 Additional languages, among which D and ADA, are available in the
45 collection. D and ADA have a binary bootstrap requirement for the first
46 installation, so their installation is not described here. To install
47 them, you can proceed along the same lines as below after installing
48 the corresponding compiler from a binary package, adding
49 <option>ada</option> or <option>d</option> to the
50 <parameter>--enable-languages</parameter> line.
51 </para>
52 </note>
53
54 &lfs111_checked;
55
56 <caution>
57 <para>
58 If you are upgrading <application>GCC</application> from any other
59 version prior to &gcc-version;, then you must be careful compiling 3rd
60 party kernel modules. You should ensure that the kernel and all its
61 native modules are also compiled using the same version of
62 <application>GCC</application> that you use to build the 3rd party module.
63 This issue does not affect native kernel (and kernel modules) updates,
64 as the instructions below are a complete reinstallation of
65 <application>GCC</application>. If you have existing 3rd party modules
66 installed, ensure they are recompiled using the updated version of
67 <application>GCC</application>. As always, never update the kernel
68 headers from the ones used when <application>Glibc</application> was
69 compiled during LFS.
70 </para>
71
72 <para>
73 Some system headers need to be fixed to be used with GCC. This is done
74 during the installation of GCC, and the <quote>fixed</quote> headers
75 are installed in <filename class="directory">
76 /usr/lib/gcc/&lt;machine triplet&gt;/&lt;GCC version&gt;/include-fixed
77 </filename>. This is harmless if GCC is built during the LFS stage. But
78 if you reinstall GCC in BLFS, some of the BLFS packages may be
79 <quote>fixed</quote>. If one of those packages is reinstalled
80 afterwards, the <quote>fixed</quote> headers are not updated, which may
81 lead to version mismatches. In case that happens, the
82 <quote>fixed</quote> headers must be updated by running (as
83 <systemitem class="username">root</systemitem>):
84 <command>
85 /usr/libexec/gcc/x86_64-pc-linux-gnu/&gcc-version;/install-tools/mkheaders
86 </command>. The machine triplet may be different on a 32-bit system.
87 </para>
88 </caution>
89
90 <bridgehead renderas="sect3">Package Information</bridgehead>
91 <itemizedlist spacing="compact">
92 <listitem>
93 <para>
94 Download (HTTP): <ulink url="&gcc-download-http;"/>
95 </para>
96 </listitem>
97 <listitem>
98 <para>
99 Download (FTP): <ulink url="&gcc-download-ftp;"/>
100 </para>
101 </listitem>
102 <listitem>
103 <para>
104 Download MD5 sum: &gcc-md5sum;
105 </para>
106 </listitem>
107 <listitem>
108 <para>
109 Download size: &gcc-size;
110 </para>
111 </listitem>
112 <listitem>
113 <para>
114 Estimated disk space required: &gcc-buildsize;
115 </para>
116 </listitem>
117 <listitem>
118 <para>
119 Estimated build time: &gcc-time;
120 </para>
121 </listitem>
122 </itemizedlist>
123
124 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
125 <itemizedlist spacing="compact">
126 <listitem>
127 <para>
128 Required patch for building against glibc-2.36:
129 <ulink url="&patch-root;/gcc-&gcc-version;-glibc_2.36-1.patch"/>
130 </para>
131 </listitem>
132 </itemizedlist>
133
134 <bridgehead renderas="sect3">GCC Dependencies</bridgehead>
135
136 <bridgehead renderas="sect4">Optional</bridgehead>
137 <para role="optional">
138 <xref linkend="gdb"/>,
139 <xref linkend="valgrind"/> (for tests), and
140 <ulink url="https://repo.or.cz/isl.git">ISL</ulink> (to enable graphite optimization)
141 </para>
142
143 <para condition="html" role="usernotes">
144 User Notes: <ulink url="&blfs-wiki;/gcc"/>
145 </para>
146
147 </sect2>
148
149 <sect2 role="installation">
150 <title>Installation of GCC</title>
151
152 <important>
153 <para>
154 Even if you specify only languages other than C and C++ to the
155 <command>./configure</command> command below, the
156 installation process will overwrite your existing
157 <application>GCC</application> C and C++ compilers and libraries.
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 First fix a problem with glibc-2.36:
182 </para>
183
184<screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-glibc_2.36-1.patch</userinput></screen>
185
186 <para>
187 Install <application>GCC</application> by running the following commands:
188 </para>
189
190<screen><userinput>case $(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++,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-12.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 100 unexpected failures out of over
215 523,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}</userinput></screen>
242
243 <para>
244 Some packages expect to find the C preprocessor in
245 <filename class="directory">/lib</filename> or may refer to the C compiler
246 under the name <command>cc</command>. The following symbolic links are not
247 needed if you have followed the LFS instructions, since they
248 have been already created. If you do not have them on your system, issue
249 as the <systemitem class="username">root</systemitem> user:
250 </para>
251
252<screen role="root"><userinput>ln -v -sf ../usr/bin/cpp /lib &amp;&amp;
253ln -v -sf gcc /usr/bin/cc &amp;&amp;
254install -v -dm755 /usr/lib/bfd-plugins &amp;&amp;
255ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/&gcc-version;/liblto_plugin.so /usr/lib/bfd-plugins/</userinput></screen>
256
257 </sect2>
258
259 <sect2 role="commands">
260 <title>Command Explanations</title>
261
262 <para>
263 <command>mkdir build; cd build</command>: The
264 <application>GCC</application> documentation recommends
265 building the package in a dedicated build directory.
266 </para>
267
268 <para>
269 <parameter>--disable-multilib</parameter>: This parameter ensures
270 that files are created for the specific architecture of your computer.
271 </para>
272
273 <para>
274 <parameter>--with-system-zlib</parameter>: Uses the system
275 <application>zlib</application> instead of the bundled one.
276 <application>zlib</application> is used for compressing
277 and uncompressing <application>GCC</application>'s intermediate
278 language in LTO (Link Time Optimization) object files.
279 </para>
280
281 <para>
282 <parameter>--enable-languages=c,c++,fortran,go,objc,obj-c++</parameter>:
283 This command identifies which languages to build. You may modify
284 this command to remove undesired languages. Other languages can be
285 added, including ADA, D, BRIG (add
286 <parameter>brig</parameter> to the list of enabled languages), a binary
287 format for HSAIL (Heterogeneous System Architecture Intermediate
288 Language), and JIT (add <parameter>jit</parameter> to the list of enabled
289 languages), a library which can be linked into interpreters that want to
290 generate machine code <quote>on the fly</quote> at run-time. They have not
291 been tested by the BLFS developers.
292 </para>
293
294 <para>
295 <command>ulimit -s 32768</command>: This command prevents several
296 tests from running out of stack space.
297 </para>
298
299 <para>
300 <command>make -k check</command>: This command runs the test suite
301 without stopping if any errors are encountered.
302 </para>
303
304 <para>
305 <command>../contrib/test_summary</command>: This command will produce
306 a summary of the test suite results. You can append <command>| grep
307 -A7 Summ</command> to the command to produce an even more condensed
308 version of the summary. You may also wish to redirect the output
309 to a file for review and comparison later on.
310 </para>
311
312 <para>
313 <command>mv -v /usr/lib/*gdb.py ...</command>: The installation
314 stage puts some files used by <application>gdb</application> under the
315 <filename class="directory">/usr/lib</filename> directory. This generates
316 spurious error messages when performing <command>ldconfig</command>. This
317 command moves the files to another location.
318 </para>
319
320 <para>
321 <command>chown -v -R root:root /usr/lib/gcc/*linux-gnu/...</command>:
322 If the package is built by a user other than root, the ownership of the
323 installed <filename class="directory">include</filename> directory (and
324 its content) will be incorrect. This command changes the ownership to the
325 <systemitem class="username">root</systemitem> user and group.
326 </para>
327
328 </sect2>
329
330 <sect2 role="content">
331 <title>Contents</title>
332
333 <para>
334 Some program and library names and descriptions are not listed here,
335 but can be found at
336 <ulink url="&lfs-root;/chapter08/gcc.html#contents-gcc">LFS section
337 for GCC</ulink> as they were
338 initially installed during the building of LFS.
339 </para>
340
341 <segmentedlist>
342 <segtitle>Installed Programs</segtitle>
343 <segtitle>Installed Libraries</segtitle>
344 <segtitle>Installed Directories</segtitle>
345
346 <seglistitem>
347 <seg>
348 gccgo, gfortran, go, and gofmt, hard-linked to architecture
349 specific names
350 </seg>
351 <seg>
352 libgfortran.{so,a},
353 libgo.{so,a}, libgobegin.a, libgolibbegin.a,
354 libobjc.{so,a}, and numerous other run-time libraries and executables
355 </seg>
356 <seg>
357 /usr/lib/go
358 </seg>
359 </seglistitem>
360 </segmentedlist>
361
362 <variablelist>
363 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
364 <?dbfo list-presentation="list"?>
365 <?dbhtml list-presentation="table"?>
366
367 <varlistentry id="gccgo">
368 <term><command>gccgo</command></term>
369 <listitem>
370 <para>
371 is a GCC-based compiler for the <application>Go</application>
372 language
373 </para>
374 <indexterm zone="gcc gccgo">
375 <primary sortas="b-gccgo">gccgo</primary>
376 </indexterm>
377 </listitem>
378 </varlistentry>
379
380 <varlistentry id="go">
381 <term><command>go</command></term>
382 <listitem>
383 <para>
384 is a tool for managing <application>Go</application> source code
385 </para>
386 <indexterm zone="gcc go">
387 <primary sortas="b-go">go</primary>
388 </indexterm>
389 </listitem>
390 </varlistentry>
391
392 <varlistentry id="gofmt">
393 <term><command>gofmt</command></term>
394 <listitem>
395 <para>
396 is a tool for formatting <application>Go</application> source code
397 </para>
398 <indexterm zone="gcc gofmt">
399 <primary sortas="b-gofmt">gofmt</primary>
400 </indexterm>
401 </listitem>
402 </varlistentry>
403 <!--
404 <varlistentry id="gdc">
405 <term><command>gdc</command></term>
406 <listitem>
407 <para>
408 is a GCC-based compiler for the <application>D</application>
409 language
410 </para>
411 <indexterm zone="gcc gdc">
412 <primary sortas="b-gdc">gdc</primary>
413 </indexterm>
414 </listitem>
415 </varlistentry>
416 -->
417 <varlistentry id="gfortran">
418 <term><command>gfortran</command></term>
419 <listitem>
420 <para>
421 is a GCC-based compiler for the <application>Fortran</application>
422 language
423 </para>
424 <indexterm zone="gcc gfortran">
425 <primary sortas="b-gfortran">gfortran</primary>
426 </indexterm>
427 </listitem>
428 </varlistentry>
429
430 </variablelist>
431
432 </sect2>
433
434</sect1>
Note: See TracBrowser for help on using the repository browser.