source: general/prog/gcc.xml@ e962ced

12.0 12.1 kea ken/TL2024 ken/tuningfonts lazarus lxqt plabs/newcss python3.11 rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18 xry111/xf86-video-removal
Last change on this file since e962ced was 11e8c12, checked in by Xi Ruoyao <xry111@…>, 14 months ago

gcc: Remove brig from "other languages"

The support for brig had been removed in GCC 12.

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