source: general/prog/gcc.xml@ 105a90a

12.1 ken/TL2024 lazarus plabs/newcss python3.11 rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18
Last change on this file since 105a90a was e1e58be, checked in by Pierre Labastie <pierre.labastie@…>, 9 months ago

Remove all ftp urls

neither firefox nor epiphany can download them, and they are not
well maintained, because rarely tested.
This is WIP because the "(HTTP)" part of "Download (HTTP)" will
need to be removed too.
But let's see what users think first...

  • Property mode set to 100644
File size: 15.3 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">
[e1e58be]8 <!ENTITY gcc-download-ftp " ">
[b5844a0]9 <!-- Update this also on the grub-uefi page -->
[5864a166]10 <!ENTITY gcc-md5sum "e0e48554cc6e4f261d55ddee9ab69075">
11 <!ENTITY gcc-size "84 MB">
12 <!ENTITY gcc-buildsize "13 GB (2.9 GB installed with all listed languages; add 1.5 GB for tests)">
13 <!ENTITY gcc-time "13 SBU (add 29 SBU for tests; both with parallelism=8)">
[52d29f7]14]>
15
[58bd309a]16<sect1 id="gcc" xreflabel="GCC-&gcc-version;">
[70e3220]17 <?dbhtml filename="gcc.html" ?>
18
19
20 <title>GCC-&gcc-version;</title>
21
22 <indexterm zone="gcc">
[ae0673a]23 <primary sortas="a-gcc-5-0">GCC-&gcc-version;</primary>
[70e3220]24 </indexterm>
25
26 <sect2 role="package">
27 <title>Introduction to GCC</title>
28
[ae0673a]29 <para>
30 The <application>GCC</application> package contains the GNU Compiler
31 Collection. This page describes the installation of compilers for the
[64e462a7]32 following languages: C, C++, Fortran, Objective C, Objective C++, Go, and Modula2.
[7354b9a]33 Since C and C++ are installed in LFS, this page is either for upgrading
34 C and C++, or for installing additional compilers.
[ae0673a]35 </para>
[5512e64]36
[7354b9a]37 <note>
38 <para>
[64e462a7]39 Additional languages, among which D and Ada, are available in the
40 collection. D and Ada have a binary bootstrap requirement for the first
[7354b9a]41 installation, so their installation is not described here. To install
42 them, you can proceed along the same lines as below after installing
43 the corresponding compiler from a binary package, adding
44 <option>ada</option> or <option>d</option> to the
45 <parameter>--enable-languages</parameter> line.
46 </para>
47 </note>
48
[282a0eb]49 &lfs120_checked;
[625d5fe5]50
[636acbb1]51 <caution>
[ae0673a]52 <para>
53 If you are upgrading <application>GCC</application> from any other
54 version prior to &gcc-version;, then you must be careful compiling 3rd
55 party kernel modules. You should ensure that the kernel and all its
56 native modules are also compiled using the same version of
57 <application>GCC</application> that you use to build the 3rd party module.
58 This issue does not affect native kernel (and kernel modules) updates,
59 as the instructions below are a complete reinstallation of
60 <application>GCC</application>. If you have existing 3rd party modules
61 installed, ensure they are recompiled using the updated version of
62 <application>GCC</application>. As always, never update the kernel
63 headers from the ones used when <application>Glibc</application> was
64 compiled during LFS.
65 </para>
[636acbb1]66 </caution>
67
[70e3220]68 <bridgehead renderas="sect3">Package Information</bridgehead>
69 <itemizedlist spacing="compact">
70 <listitem>
[ae0673a]71 <para>
72 Download (HTTP): <ulink url="&gcc-download-http;"/>
73 </para>
[70e3220]74 </listitem>
75 <listitem>
[ae0673a]76 <para>
77 Download (FTP): <ulink url="&gcc-download-ftp;"/>
78 </para>
[70e3220]79 </listitem>
80 <listitem>
[ae0673a]81 <para>
82 Download MD5 sum: &gcc-md5sum;
83 </para>
[70e3220]84 </listitem>
85 <listitem>
[ae0673a]86 <para>
87 Download size: &gcc-size;
88 </para>
[70e3220]89 </listitem>
90 <listitem>
[ae0673a]91 <para>
92 Estimated disk space required: &gcc-buildsize;
93 </para>
[70e3220]94 </listitem>
95 <listitem>
[ae0673a]96 <para>
97 Estimated build time: &gcc-time;
98 </para>
[70e3220]99 </listitem>
100 </itemizedlist>
[64e462a7]101<!--
[12ab2eb]102 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
103 <itemizedlist spacing="compact">
104 <listitem>
105 <para>
[f0dd071]106 Optional patch when adding Go to the desired language list:
107 <ulink url="&patch-root;/gcc-&gcc-version;-fix_go_version-1.patch"/>
[12ab2eb]108 </para>
109 </listitem>
110 </itemizedlist>
[64e462a7]111-->
[70e3220]112 <bridgehead renderas="sect3">GCC Dependencies</bridgehead>
[7354b9a]113
[a7e88c5c]114 <bridgehead renderas="sect4">Optional</bridgehead>
115 <para role="optional">
[1a8a995]116 <xref linkend="gdb"/>,
117 <xref linkend="valgrind"/> (for tests), and
118 <ulink url="https://repo.or.cz/isl.git">ISL</ulink> (to enable graphite optimization)
[a7e88c5c]119 </para>
[8558044]120
[ae0673a]121 <para condition="html" role="usernotes">
[42ddc30]122 Editor Notes: <ulink url="&blfs-wiki;/gcc"/>
[ae0673a]123 </para>
[1039de3]124
[70e3220]125 </sect2>
[034eda7]126
[70e3220]127 <sect2 role="installation">
128 <title>Installation of GCC</title>
129
130 <important>
[ae0673a]131 <para>
132 Even if you specify only languages other than C and C++ to the
133 <command>./configure</command> command below, the
134 installation process will overwrite your existing
135 <application>GCC</application> C and C++ compilers and libraries.
[3026cde]136 Running the full suite of tests is recommended.
[ae0673a]137 </para>
138
139 <para>
140 Do not continue with the <command>make install</command> command
141 until you are confident the build was successful. You can compare your
142 test results with those found at <ulink
[579bdb04]143 url="https://gcc.gnu.org/ml/gcc-testresults/"/>. You may also want to
[ae0673a]144 refer to the information found in the <application>GCC</application>
[f0dc9578]145 section of Chapter 8 in the LFS book (<ulink
146 url="&lfs-root;/chapter08/gcc.html"/>).
[ae0673a]147 </para>
[70e3220]148 </important>
149
[ae0673a]150 <para>
151 The instructions below are intentionally performing a
152 <quote>bootstrap</quote> process. Bootstrapping is needed for robustness
153 and is highly recommended when upgrading the compilers version. To disable
[0c953f12]154 bootstrap anyway, add <parameter>--disable-bootstrap</parameter> to the
[ae0673a]155 <command>./configure</command> options below.
156 </para>
[12ab2eb]157
[ae0673a]158 <para>
[e6d0be6]159 Install <application>GCC</application> by running the following commands:
[ae0673a]160 </para>
161
[e6d0be6]162<screen><userinput>case $(uname -m) in
[92245989]163 x86_64)
[df0e196]164 sed -i.orig '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
[92245989]165 ;;
166esac
167
[64e462a7]168mkdir build &amp;&amp;
169cd build &amp;&amp;
170
171../configure \
172 --prefix=/usr \
173 --disable-multilib \
174 --with-system-zlib \
175 --enable-default-pie \
176 --enable-default-ssp \
177 --disable-fixincludes \
178 --enable-languages=c,c++,fortran,go,objc,obj-c++,m2 &amp;&amp;
[7cadfea]179make</userinput></screen>
[5512e64]180
[ae0673a]181 <para>
182 If you have installed additional packages such as
[64e462a7]183 <application>valgrind</application> and <application>gdb</application>,
184 the <application>gcc</application> part of the test suite will run more
[ae0673a]185 tests than in LFS. Some of those will report FAIL and others XPASS
[5864a166]186 (pass when expected to FAIL). As of gcc-13.2.0, about 65 FAIL occur
[3b187ea]187 in the <quote>guality</quote> suite, as well as miscellaneous failures
[64e462a7]188 throughout the rest of the test suite.
[e440af5]189 If all the compilers above are built, there will be a little over 80
[5864a166]190 unexpected failures out of over 546,000 tests. To run the tests, issue:
[ae0673a]191 </para>
[d3757f1c]192
[7cadfea]193<screen><userinput>ulimit -s 32768 &amp;&amp;
[b10cfc81]194make -k check</userinput></screen>
195<!-- The command above may error out, so using && may prevent the summary
196to be run. -->
197
[ae0673a]198 <para>
199 The tests are very long, and the results may be hard to find in the
200 logs, specially if you use parallel jobs with make. You can get a summary
201 of the tests with:
202 </para>
[5512e64]203
[0e64979]204<screen><userinput>../contrib/test_summary</userinput></screen>
[8c9ec303]205
[ae0673a]206 <para>
207 Now, as the <systemitem class="username">root</systemitem> user:
208 </para>
[8c9ec303]209
[70e3220]210<screen role="root"><userinput>make install &amp;&amp;
[5512e64]211
[7cadfea]212mkdir -pv /usr/share/gdb/auto-load/usr/lib &amp;&amp;
213mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib &amp;&amp;
214
[38485e5c]215chown -v -R root:root \
[7354b9a]216 /usr/lib/gcc/*linux-gnu/&gcc-version;/include{,-fixed}</userinput></screen>
[f182eed]217
[70e3220]218 </sect2>
219
220 <sect2 role="commands">
221 <title>Command Explanations</title>
[8ddc247]222
[2d488eb]223 <para>
[0e64979]224 <command>mkdir build; cd build</command>: The
[2d488eb]225 <application>GCC</application> documentation recommends
226 building the package in a dedicated build directory.
227 </para>
[70e3220]228
[2d488eb]229 <para>
230 <parameter>--disable-multilib</parameter>: This parameter ensures
231 that files are created for the specific architecture of your computer.
232 </para>
[7cadfea]233
[2d488eb]234 <para>
[fa200b8]235 <parameter>--with-system-zlib</parameter>: Uses the system
[2d488eb]236 <application>zlib</application> instead of the bundled one.
237 <application>zlib</application> is used for compressing
[b89180f]238 and decompressing <application>GCC</application>'s intermediate
[2d488eb]239 language in LTO (Link Time Optimization) object files.
240 </para>
[034eda7]241
[b89180f]242 <para>
243 <parameter>--enable-default-pie</parameter>: Makes the
244 <option>-fpie</option> option the default when compiling programs.
245 Together with the <xref linkend="gASLR"/> feature enabled in the kernel,
246 this defeats some kind of attacks based on known memory layouts.
247 </para>
248
249 <para>
250 <parameter>--enable-default-ssp</parameter>: Makes the
251 <option>-fstack-protector-strong</option> option the default when
252 compiling programs. <xref linkend="gSSP"/> is a technique preventing
253 alteration of the program flow by corrupting the parameter stack.
254 </para>
255
[800c9c3]256 <para>
[64e462a7]257 <parameter>--enable-languages=c,c++,fortran,go,objc,obj-c++,m2</parameter>:
[2d488eb]258 This command identifies which languages to build. You may modify
[0c0bf1f]259 this command to remove undesired languages. GCC also supports Ada
260 and D, but building GCC with Ada (or D) support needs an existing
261 Ada (or D) compiler. So they are not enabled here.
[2d488eb]262 </para>
[ae0673a]263
[2d488eb]264 <para>
265 <command>ulimit -s 32768</command>: This command prevents several
266 tests from running out of stack space.
267 </para>
268
269 <para>
270 <command>make -k check</command>: This command runs the test suite
271 without stopping if any errors are encountered.
272 </para>
273
274 <para>
[9562b375]275 <command>../contrib/test_summary</command>: This command will produce
276 a summary of the test suite results. You can append <command>| grep
277 -A7 Summ</command> to the command to produce an even more condensed
278 version of the summary. You may also wish to redirect the output
[2d488eb]279 to a file for review and comparison later on.
280 </para>
281
282 <para>
283 <command>mv -v /usr/lib/*gdb.py ...</command>: The installation
284 stage puts some files used by <application>gdb</application> under the
285 <filename class="directory">/usr/lib</filename> directory. This generates
286 spurious error messages when performing <command>ldconfig</command>. This
287 command moves the files to another location.
288 </para>
289
290 <para>
291 <command>chown -v -R root:root /usr/lib/gcc/*linux-gnu/...</command>:
292 If the package is built by a user other than root, the ownership of the
293 installed <filename class="directory">include</filename> directory (and
294 its content) will be incorrect. This command changes the ownership to the
295 <systemitem class="username">root</systemitem> user and group.
296 </para>
[0c0bf1f]297
298 <para>
299 <option>--enable-host-shared --enable-languages=jit</option>:
300 Build <systemitem class="library">libgccjit</systemitem>, a library
301 for embedding GCC inside programs and libraries for generating machine
302 code. Despite <quote>JIT</quote> (just-in-time) in the name, the
303 library can be used for AOT (ahead-of-time) compilation as well.
304 <option>--enable-host-shared</option> is needed for building
305 <systemitem class="library">libgccjit</systemitem>, but it
306 significantly slows down GCC. So
307 <systemitem class="library">libgccjit</systemitem> should be built and
308 installed separately, not as a part of the <quote>main</quote> GCC
309 installation. If you need this library, configure GCC with
310 these two options and install the library by running
311 <!-- from Arch, not tested -->
312 <command>make -C gcc jit.install-common jit.install-info</command>
313 as the &root; user. This library is not used by any BLFS package,
314 nor tested by the BLFS developers.
315 </para>
[034eda7]316
[70e3220]317 </sect2>
318
319 <sect2 role="content">
320 <title>Contents</title>
321
[ae0673a]322 <para>
323 Some program and library names and descriptions are not listed here,
324 but can be found at
[9771f84]325 <ulink url="&lfs-root;/chapter08/gcc.html#contents-gcc">LFS section
326 for GCC</ulink> as they were
[ae0673a]327 initially installed during the building of LFS.
328 </para>
[2d488eb]329
[70e3220]330 <segmentedlist>
331 <segtitle>Installed Programs</segtitle>
332 <segtitle>Installed Libraries</segtitle>
333 <segtitle>Installed Directories</segtitle>
334
335 <seglistitem>
[7cadfea]336 <seg>
[bcedca6]337 gccgo, gfortran, gm2, go, and gofmt, hard-linked to architecture
[adbf61f]338 specific names
[7cadfea]339 </seg>
340 <seg>
[bcedca6]341 libgfortran.{so,a}, libgm2.{so,a}
[9562b375]342 libgo.{so,a}, libgobegin.a, libgolibbegin.a,
[d7d743f0]343 libobjc.{so,a}, and numerous other run-time libraries and executables
[7cadfea]344 </seg>
345 <seg>
[d5e9aa8]346 /usr/lib/go
[7cadfea]347 </seg>
[70e3220]348 </seglistitem>
349 </segmentedlist>
350
351 <variablelist>
352 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
353 <?dbfo list-presentation="list"?>
354 <?dbhtml list-presentation="table"?>
355
[034eda7]356 <varlistentry id="gccgo">
357 <term><command>gccgo</command></term>
358 <listitem>
[ae0673a]359 <para>
[5b55f9b3]360 is a GCC-based compiler for the <application>Go</application>
[4c24eb0a]361 language
[ae0673a]362 </para>
[034eda7]363 <indexterm zone="gcc gccgo">
364 <primary sortas="b-gccgo">gccgo</primary>
[70e3220]365 </indexterm>
366 </listitem>
367 </varlistentry>
368
[bcedca6]369 <varlistentry id="gm2">
370 <term><command>gm2</command></term>
371 <listitem>
372 <para>
373 is a GCC-based compiler for the
374 <application>Modula-2</application> language
375 </para>
376 <indexterm zone="gcc gm2">
377 <primary sortas="b-gm2">gm2</primary>
378 </indexterm>
379 </listitem>
380 </varlistentry>
381
[87532434]382 <varlistentry id="go">
383 <term><command>go</command></term>
384 <listitem>
385 <para>
[4c24eb0a]386 is a tool for managing <application>Go</application> source code
[87532434]387 </para>
388 <indexterm zone="gcc go">
389 <primary sortas="b-go">go</primary>
390 </indexterm>
391 </listitem>
392 </varlistentry>
393
394 <varlistentry id="gofmt">
395 <term><command>gofmt</command></term>
396 <listitem>
397 <para>
[4c24eb0a]398 is a tool for formatting <application>Go</application> source code
[87532434]399 </para>
400 <indexterm zone="gcc gofmt">
401 <primary sortas="b-gofmt">gofmt</primary>
402 </indexterm>
403 </listitem>
404 </varlistentry>
[7354b9a]405 <!--
[adbf61f]406 <varlistentry id="gdc">
407 <term><command>gdc</command></term>
408 <listitem>
409 <para>
410 is a GCC-based compiler for the <application>D</application>
[4c24eb0a]411 language
[adbf61f]412 </para>
413 <indexterm zone="gcc gdc">
414 <primary sortas="b-gdc">gdc</primary>
415 </indexterm>
416 </listitem>
417 </varlistentry>
[7354b9a]418 -->
[800c9c3]419 <varlistentry id="gfortran">
420 <term><command>gfortran</command></term>
421 <listitem>
[ae0673a]422 <para>
423 is a GCC-based compiler for the <application>Fortran</application>
[4c24eb0a]424 language
[ae0673a]425 </para>
[800c9c3]426 <indexterm zone="gcc gfortran">
427 <primary sortas="b-gfortran">gfortran</primary>
428 </indexterm>
429 </listitem>
430 </varlistentry>
431
[70e3220]432 </variablelist>
433
434 </sect2>
[1a686a1]435
436</sect1>
Note: See TracBrowser for help on using the repository browser.