source: general/prog/gcc.xml@ cf5de42

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 cf5de42 was cf5de42, checked in by Pierre Labastie <pierre.labastie@…>, 2 years ago

The libasan sed is not needed anymore in gcc

  • Property mode set to 100644
File size: 16.5 KB
RevLine 
[52d29f7]1<?xml version="1.0" encoding="ISO-8859-1"?>
[6732c094]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
[52d29f7]4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
[8dfc5c3]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">
[7cd114e]9 <!ENTITY gcc-md5sum "4ee3e8c4c99e7b3444eb79f00f5f7a7e">
[e99d2b6]10 <!ENTITY gcc-size "77 MB">
11 <!ENTITY gcc-buildsize "8.0 GB (2.4 GB installed with all listed languages; add 1.0 GB for tests)">
[8f58378e]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 -->
[7cd114e]14 <!ENTITY gcc-time "25 SBU (add 56 SBU for tests; both with parallelism=4)">
[52d29f7]15]>
16
[58bd309a]17<sect1 id="gcc" xreflabel="GCC-&gcc-version;">
[70e3220]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">
[ae0673a]27 <primary sortas="a-gcc-5-0">GCC-&gcc-version;</primary>
[70e3220]28 </indexterm>
29
30 <sect2 role="package">
31 <title>Introduction to GCC</title>
32
[ae0673a]33 <para>
34 The <application>GCC</application> package contains the GNU Compiler
35 Collection. This page describes the installation of compilers for the
[0f1cd72e]36 following languages: C, C++, D, Fortran, Objective C, Objective C++, and Go.
[0a4d6ef0]37 <!--One additional language, Ada, is available in the collection. It has
[0f18e26]38 a binary bootstrap requirement for the first installation, so it is
[0a4d6ef0]39 described on a separate page (<xref linkend="gcc-ada"/>) but can be added
[0f18e26]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
[0a4d6ef0]42 installing additional compilers.-->
[ae0673a]43 </para>
[5512e64]44
[c2f9a33]45 &lfs111_checked;
[625d5fe5]46
[636acbb1]47 <caution>
[ae0673a]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>
[e9cab664]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>
[da8e9f9]76 /usr/libexec/gcc/x86_64-pc-linux-gnu/&gcc-version;/install-tools/mkheaders
[b9c353b]77 </command>. The machine triplet may be different on a 32-bit system.
[ae0673a]78 </para>
[636acbb1]79 </caution>
80
[70e3220]81 <bridgehead renderas="sect3">Package Information</bridgehead>
82 <itemizedlist spacing="compact">
83 <listitem>
[ae0673a]84 <para>
85 Download (HTTP): <ulink url="&gcc-download-http;"/>
86 </para>
[70e3220]87 </listitem>
88 <listitem>
[ae0673a]89 <para>
90 Download (FTP): <ulink url="&gcc-download-ftp;"/>
91 </para>
[70e3220]92 </listitem>
93 <listitem>
[ae0673a]94 <para>
95 Download MD5 sum: &gcc-md5sum;
96 </para>
[70e3220]97 </listitem>
98 <listitem>
[ae0673a]99 <para>
100 Download size: &gcc-size;
101 </para>
[70e3220]102 </listitem>
103 <listitem>
[ae0673a]104 <para>
105 Estimated disk space required: &gcc-buildsize;
106 </para>
[70e3220]107 </listitem>
108 <listitem>
[ae0673a]109 <para>
110 Estimated build time: &gcc-time;
111 </para>
[70e3220]112 </listitem>
113 </itemizedlist>
[ae0673a]114
[70e3220]115 <bridgehead renderas="sect3">GCC Dependencies</bridgehead>
[f4002c5]116<!--
[7cadfea]117 <bridgehead renderas="sect4">Recommended</bridgehead>
118 <para role="recommended">
[eb631ac]119 <xref linkend="dejagnu"/>, for tests
[7cadfea]120 </para>
[f4002c5]121-->
[a7e88c5c]122 <bridgehead renderas="sect4">Optional</bridgehead>
123 <para role="optional">
[1a8a995]124 <xref linkend="gdb"/>,
125 <xref linkend="valgrind"/> (for tests), and
126 <ulink url="https://repo.or.cz/isl.git">ISL</ulink> (to enable graphite optimization)
[a7e88c5c]127 </para>
[8558044]128
[ae0673a]129 <para condition="html" role="usernotes">
130 User Notes: <ulink url="&blfs-wiki;/gcc"/>
131 </para>
[1039de3]132
[70e3220]133 </sect2>
[034eda7]134
[70e3220]135 <sect2 role="installation">
136 <title>Installation of GCC</title>
137
138 <important>
[ae0673a]139 <para>
140 Even if you specify only languages other than C and C++ to the
141 <command>./configure</command> command below, the
142 installation process will overwrite your existing
143 <application>GCC</application> C and C++ compilers and libraries.
[229d069]144 <!--Having the <application>Tcl</application>,
[ae0673a]145 <application>Expect</application> and <application>DejaGnu</application>
146 packages installed before beginning the build is highly recommended so
[229d069]147 you can run the full suite of tests.-->
[3026cde]148 Running the full suite of tests is recommended.
[ae0673a]149 </para>
150
151 <para>
152 Do not continue with the <command>make install</command> command
153 until you are confident the build was successful. You can compare your
154 test results with those found at <ulink
[579bdb04]155 url="https://gcc.gnu.org/ml/gcc-testresults/"/>. You may also want to
[ae0673a]156 refer to the information found in the <application>GCC</application>
[f0dc9578]157 section of Chapter 8 in the LFS book (<ulink
158 url="&lfs-root;/chapter08/gcc.html"/>).
[ae0673a]159 </para>
[70e3220]160 </important>
161
[ae0673a]162 <para>
163 The instructions below are intentionally performing a
164 <quote>bootstrap</quote> process. Bootstrapping is needed for robustness
165 and is highly recommended when upgrading the compilers version. To disable
166 bootstrap anyways, add <parameter>--disable-bootstrap</parameter> to the
167 <command>./configure</command> options below.
168 </para>
[cf5de42]169<!-- Fixed in gcc-11.0.3
[9654a22]170 <para>
171 As in LFS fix an issue breaking libasan.a identified upstream:
172 </para>
173
174<screen><userinput>sed -e '/static.*SIGSTKSZ/d' \
175 -e 's/return kAltStackSize/return SIGSTKSZ * 4/' \
176 -i libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp</userinput></screen>
[cf5de42]177-->
[ae0673a]178 <para>
[e6d0be6]179 Install <application>GCC</application> by running the following commands:
[ae0673a]180 </para>
181
[e6d0be6]182<screen><userinput>case $(uname -m) in
[92245989]183 x86_64)
[df0e196]184 sed -i.orig '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
[92245989]185 ;;
186esac
187
[adbf61f]188mkdir build &amp;&amp;
189cd build &amp;&amp;
190
191../configure \
192 --prefix=/usr \
193 --disable-multilib \
194 --with-system-zlib \
195 --enable-languages=c,c++,d,fortran,go,objc,obj-c++ &amp;&amp;
[7cadfea]196make</userinput></screen>
[5512e64]197
[ae0673a]198 <para>
199 If you have installed additional packages such as
200 <application>Valgrind</application> and <application>GDB</application>,
201 the <application>GCC</application> part of the testsuite will run more
202 tests than in LFS. Some of those will report FAIL and others XPASS
[7cd114e]203 (pass when expected to FAIL). As of gcc-11.3.0, about 90 FAIL occur
[3b187ea]204 in the <quote>guality</quote> suite, as well as miscellaneous failures
205 throughout the rest of the test suite. If all the compilers above are
[7cd114e]206 built, there will be around 111 unexpected failures out of over
[8f58378e]207 481,000 tests. To run the tests, issue:
[ae0673a]208 </para>
[d3757f1c]209
[7cadfea]210<screen><userinput>ulimit -s 32768 &amp;&amp;
[b10cfc81]211make -k check</userinput></screen>
212<!-- The command above may error out, so using && may prevent the summary
213to be run. -->
214
[ae0673a]215 <para>
216 The tests are very long, and the results may be hard to find in the
217 logs, specially if you use parallel jobs with make. You can get a summary
218 of the tests with:
219 </para>
[5512e64]220
[0e64979]221<screen><userinput>../contrib/test_summary</userinput></screen>
[8c9ec303]222
[e99d2b6]223 <para>A few tests, less than 20 out of about 450,000, will fail, but unless
224 the failures are excessive, they can be ignored.</para>
225
[ae0673a]226 <para>
227 Now, as the <systemitem class="username">root</systemitem> user:
228 </para>
[8c9ec303]229
[70e3220]230<screen role="root"><userinput>make install &amp;&amp;
[5512e64]231
[7cadfea]232mkdir -pv /usr/share/gdb/auto-load/usr/lib &amp;&amp;
233mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib &amp;&amp;
234
[38485e5c]235chown -v -R root:root \
[09aa3292]236 /usr/lib/gcc/*linux-gnu/&gcc-version;/include{,-fixed}
237
238rm -rf /usr/lib/gcc/$(gcc -dumpmachine)/&gcc-version;/include-fixed/bits/</userinput></screen>
[f182eed]239
[ae0673a]240 <para>
241 Some packages expect to find the C preprocessor in
242 <filename class="directory">/lib</filename> or may refer to the C compiler
243 under the name <command>cc</command>. The following symbolic links are not
244 needed if you have followed the LFS instructions, since they
245 have been already created. If you do not have them on your system, issue
246 as the <systemitem class="username">root</systemitem> user:
247 </para>
[70e3220]248
[ae0673a]249<screen role="root"><userinput>ln -v -sf ../usr/bin/cpp /lib &amp;&amp;
250ln -v -sf gcc /usr/bin/cc &amp;&amp;
251install -v -dm755 /usr/lib/bfd-plugins &amp;&amp;
252ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/&gcc-version;/liblto_plugin.so /usr/lib/bfd-plugins/</userinput></screen>
[034eda7]253
[70e3220]254 </sect2>
255
256 <sect2 role="commands">
257 <title>Command Explanations</title>
[8ddc247]258
[2d488eb]259 <para>
[0e64979]260 <command>mkdir build; cd build</command>: The
[2d488eb]261 <application>GCC</application> documentation recommends
262 building the package in a dedicated build directory.
263 </para>
[70e3220]264
[2d488eb]265 <para>
266 <parameter>--disable-multilib</parameter>: This parameter ensures
267 that files are created for the specific architecture of your computer.
268 </para>
[7cadfea]269
[2d488eb]270 <para>
[fa200b8]271 <parameter>--with-system-zlib</parameter>: Uses the system
[2d488eb]272 <application>zlib</application> instead of the bundled one.
273 <application>zlib</application> is used for compressing
274 and uncompressing <application>GCC</application>'s intermediate
275 language in LTO (Link Time Optimization) object files.
276 </para>
[034eda7]277
[800c9c3]278 <para>
[adbf61f]279 <parameter>--enable-languages=c,c++,d,fortran,go,objc,obj-c++</parameter>:
[2d488eb]280 This command identifies which languages to build. You may modify
[229d069]281 this command to remove undesired languages. Three other languages can be
282 added, including ADA, BRIG (add
[3d9141c]283 <parameter>brig</parameter> to the list of enabled languages), a binary
[9562b375]284 format for HSAIL (Heterogeneous System Architecture Intermediate
[3d9141c]285 Language), and JIT (add <parameter>jit</parameter> to the list of enabled
[0f18e26]286 languages), a library which can be linked into interpreters that want to
287 generate machine code <quote>on the fly</quote> at run-time. They have not
288 been tested by the BLFS developers.
[2d488eb]289 </para>
[8558044]290 <!-- It's been three major versions now, and many years.
[a7e88c5c]291 Commenting out unless needed somewhere. -renodr
[ae0673a]292 <para>
[a7e88c5c]293 <option>- -with-default-libstdcxx-abi=gcc4-compatible</option>: Use this
[0e64979]294 switch if you are upgrading from a <application>GCC</application>
295 version prior to 5.1.0, and you do not want to recompile all the
296 libraries written in C++.
[ae0673a]297 </para>
[a7e88c5c]298 -->
[ae0673a]299
[2d488eb]300 <para>
301 <command>ulimit -s 32768</command>: This command prevents several
302 tests from running out of stack space.
303 </para>
304
305 <para>
306 <command>make -k check</command>: This command runs the test suite
307 without stopping if any errors are encountered.
308 </para>
309
310 <para>
[9562b375]311 <command>../contrib/test_summary</command>: This command will produce
312 a summary of the test suite results. You can append <command>| grep
313 -A7 Summ</command> to the command to produce an even more condensed
314 version of the summary. You may also wish to redirect the output
[2d488eb]315 to a file for review and comparison later on.
316 </para>
317
318 <para>
319 <command>mv -v /usr/lib/*gdb.py ...</command>: The installation
320 stage puts some files used by <application>gdb</application> under the
321 <filename class="directory">/usr/lib</filename> directory. This generates
322 spurious error messages when performing <command>ldconfig</command>. This
323 command moves the files to another location.
324 </para>
325
326 <para>
327 <command>chown -v -R root:root /usr/lib/gcc/*linux-gnu/...</command>:
328 If the package is built by a user other than root, the ownership of the
329 installed <filename class="directory">include</filename> directory (and
330 its content) will be incorrect. This command changes the ownership to the
331 <systemitem class="username">root</systemitem> user and group.
332 </para>
[034eda7]333
[09aa3292]334 <para>
335 <command>rm -rf .../include-fixed/bits/</command>: Remove an erroneous
336 file in gcc added by the fixincludes process.
337 </para>
338
[70e3220]339 </sect2>
340
341 <sect2 role="content">
342 <title>Contents</title>
343
[ae0673a]344 <para>
345 Some program and library names and descriptions are not listed here,
346 but can be found at
[9771f84]347 <ulink url="&lfs-root;/chapter08/gcc.html#contents-gcc">LFS section
348 for GCC</ulink> as they were
[ae0673a]349 initially installed during the building of LFS.
350 </para>
[2d488eb]351
[70e3220]352 <segmentedlist>
353 <segtitle>Installed Programs</segtitle>
354 <segtitle>Installed Libraries</segtitle>
355 <segtitle>Installed Directories</segtitle>
356
357 <seglistitem>
[7cadfea]358 <seg>
[4c22625]359 gccgo, gdc, gfortran, go, and gofmt, hard-linked to architecture
[adbf61f]360 specific names
[7cadfea]361 </seg>
362 <seg>
[d7d743f0]363 libgfortran.{so,a},
[adbf61f]364 libgdruntime.{so,a}, libgphobos.{so,a}
[9562b375]365 libgo.{so,a}, libgobegin.a, libgolibbegin.a,
[d7d743f0]366 libobjc.{so,a}, and numerous other run-time libraries and executables
[7cadfea]367 </seg>
368 <seg>
[d5e9aa8]369 /usr/lib/go
[7cadfea]370 </seg>
[70e3220]371 </seglistitem>
372 </segmentedlist>
373
374 <variablelist>
375 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
376 <?dbfo list-presentation="list"?>
377 <?dbhtml list-presentation="table"?>
378
[034eda7]379 <varlistentry id="gccgo">
380 <term><command>gccgo</command></term>
381 <listitem>
[ae0673a]382 <para>
[5b55f9b3]383 is a GCC-based compiler for the <application>Go</application>
[4c24eb0a]384 language
[ae0673a]385 </para>
[034eda7]386 <indexterm zone="gcc gccgo">
387 <primary sortas="b-gccgo">gccgo</primary>
[70e3220]388 </indexterm>
389 </listitem>
390 </varlistentry>
391
[87532434]392 <varlistentry id="go">
393 <term><command>go</command></term>
394 <listitem>
395 <para>
[4c24eb0a]396 is a tool for managing <application>Go</application> source code
[87532434]397 </para>
398 <indexterm zone="gcc go">
399 <primary sortas="b-go">go</primary>
400 </indexterm>
401 </listitem>
402 </varlistentry>
403
404 <varlistentry id="gofmt">
405 <term><command>gofmt</command></term>
406 <listitem>
407 <para>
[4c24eb0a]408 is a tool for formatting <application>Go</application> source code
[87532434]409 </para>
410 <indexterm zone="gcc gofmt">
411 <primary sortas="b-gofmt">gofmt</primary>
412 </indexterm>
413 </listitem>
414 </varlistentry>
415
[adbf61f]416 <varlistentry id="gdc">
417 <term><command>gdc</command></term>
418 <listitem>
419 <para>
420 is a GCC-based compiler for the <application>D</application>
[4c24eb0a]421 language
[adbf61f]422 </para>
423 <indexterm zone="gcc gdc">
424 <primary sortas="b-gdc">gdc</primary>
425 </indexterm>
426 </listitem>
427 </varlistentry>
428
[800c9c3]429 <varlistentry id="gfortran">
430 <term><command>gfortran</command></term>
431 <listitem>
[ae0673a]432 <para>
433 is a GCC-based compiler for the <application>Fortran</application>
[4c24eb0a]434 language
[ae0673a]435 </para>
[800c9c3]436 <indexterm zone="gcc gfortran">
437 <primary sortas="b-gfortran">gfortran</primary>
438 </indexterm>
439 </listitem>
440 </varlistentry>
441
[70e3220]442 </variablelist>
443
444 </sect2>
[1a686a1]445
446</sect1>
Note: See TracBrowser for help on using the repository browser.