source: general/prog/gcc.xml@ 52f84d9

12.1 ken/TL2024 ken/tuningfonts lazarus plabs/newcss python3.11 rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18
Last change on this file since 52f84d9 was e1e58be, checked in by Pierre Labastie <pierre.labastie@…>, 8 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
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 " ">
9 <!-- Update this also on the grub-uefi page -->
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)">
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 &lfs120_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 </caution>
67
68 <bridgehead renderas="sect3">Package Information</bridgehead>
69 <itemizedlist spacing="compact">
70 <listitem>
71 <para>
72 Download (HTTP): <ulink url="&gcc-download-http;"/>
73 </para>
74 </listitem>
75 <listitem>
76 <para>
77 Download (FTP): <ulink url="&gcc-download-ftp;"/>
78 </para>
79 </listitem>
80 <listitem>
81 <para>
82 Download MD5 sum: &gcc-md5sum;
83 </para>
84 </listitem>
85 <listitem>
86 <para>
87 Download size: &gcc-size;
88 </para>
89 </listitem>
90 <listitem>
91 <para>
92 Estimated disk space required: &gcc-buildsize;
93 </para>
94 </listitem>
95 <listitem>
96 <para>
97 Estimated build time: &gcc-time;
98 </para>
99 </listitem>
100 </itemizedlist>
101<!--
102 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
103 <itemizedlist spacing="compact">
104 <listitem>
105 <para>
106 Optional patch when adding Go to the desired language list:
107 <ulink url="&patch-root;/gcc-&gcc-version;-fix_go_version-1.patch"/>
108 </para>
109 </listitem>
110 </itemizedlist>
111-->
112 <bridgehead renderas="sect3">GCC Dependencies</bridgehead>
113
114 <bridgehead renderas="sect4">Optional</bridgehead>
115 <para role="optional">
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)
119 </para>
120
121 <para condition="html" role="usernotes">
122 Editor Notes: <ulink url="&blfs-wiki;/gcc"/>
123 </para>
124
125 </sect2>
126
127 <sect2 role="installation">
128 <title>Installation of GCC</title>
129
130 <important>
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.
136 Running the full suite of tests is recommended.
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
143 url="https://gcc.gnu.org/ml/gcc-testresults/"/>. You may also want to
144 refer to the information found in the <application>GCC</application>
145 section of Chapter 8 in the LFS book (<ulink
146 url="&lfs-root;/chapter08/gcc.html"/>).
147 </para>
148 </important>
149
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
154 bootstrap anyway, add <parameter>--disable-bootstrap</parameter> to the
155 <command>./configure</command> options below.
156 </para>
157
158 <para>
159 Install <application>GCC</application> by running the following commands:
160 </para>
161
162<screen><userinput>case $(uname -m) in
163 x86_64)
164 sed -i.orig '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
165 ;;
166esac
167
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;
179make</userinput></screen>
180
181 <para>
182 If you have installed additional packages such as
183 <application>valgrind</application> and <application>gdb</application>,
184 the <application>gcc</application> part of the test suite will run more
185 tests than in LFS. Some of those will report FAIL and others XPASS
186 (pass when expected to FAIL). As of gcc-13.2.0, about 65 FAIL occur
187 in the <quote>guality</quote> suite, as well as miscellaneous failures
188 throughout the rest of the test suite.
189 If all the compilers above are built, there will be a little over 80
190 unexpected failures out of over 546,000 tests. To run the tests, issue:
191 </para>
192
193<screen><userinput>ulimit -s 32768 &amp;&amp;
194make -k check</userinput></screen>
195<!-- The command above may error out, so using && may prevent the summary
196to be run. -->
197
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>
203
204<screen><userinput>../contrib/test_summary</userinput></screen>
205
206 <para>
207 Now, as the <systemitem class="username">root</systemitem> user:
208 </para>
209
210<screen role="root"><userinput>make install &amp;&amp;
211
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
215chown -v -R root:root \
216 /usr/lib/gcc/*linux-gnu/&gcc-version;/include{,-fixed}</userinput></screen>
217
218 </sect2>
219
220 <sect2 role="commands">
221 <title>Command Explanations</title>
222
223 <para>
224 <command>mkdir build; cd build</command>: The
225 <application>GCC</application> documentation recommends
226 building the package in a dedicated build directory.
227 </para>
228
229 <para>
230 <parameter>--disable-multilib</parameter>: This parameter ensures
231 that files are created for the specific architecture of your computer.
232 </para>
233
234 <para>
235 <parameter>--with-system-zlib</parameter>: Uses the system
236 <application>zlib</application> instead of the bundled one.
237 <application>zlib</application> is used for compressing
238 and decompressing <application>GCC</application>'s intermediate
239 language in LTO (Link Time Optimization) object files.
240 </para>
241
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
256 <para>
257 <parameter>--enable-languages=c,c++,fortran,go,objc,obj-c++,m2</parameter>:
258 This command identifies which languages to build. You may modify
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.
262 </para>
263
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>
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
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>
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>
316
317 </sect2>
318
319 <sect2 role="content">
320 <title>Contents</title>
321
322 <para>
323 Some program and library names and descriptions are not listed here,
324 but can be found at
325 <ulink url="&lfs-root;/chapter08/gcc.html#contents-gcc">LFS section
326 for GCC</ulink> as they were
327 initially installed during the building of LFS.
328 </para>
329
330 <segmentedlist>
331 <segtitle>Installed Programs</segtitle>
332 <segtitle>Installed Libraries</segtitle>
333 <segtitle>Installed Directories</segtitle>
334
335 <seglistitem>
336 <seg>
337 gccgo, gfortran, gm2, go, and gofmt, hard-linked to architecture
338 specific names
339 </seg>
340 <seg>
341 libgfortran.{so,a}, libgm2.{so,a}
342 libgo.{so,a}, libgobegin.a, libgolibbegin.a,
343 libobjc.{so,a}, and numerous other run-time libraries and executables
344 </seg>
345 <seg>
346 /usr/lib/go
347 </seg>
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
356 <varlistentry id="gccgo">
357 <term><command>gccgo</command></term>
358 <listitem>
359 <para>
360 is a GCC-based compiler for the <application>Go</application>
361 language
362 </para>
363 <indexterm zone="gcc gccgo">
364 <primary sortas="b-gccgo">gccgo</primary>
365 </indexterm>
366 </listitem>
367 </varlistentry>
368
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
382 <varlistentry id="go">
383 <term><command>go</command></term>
384 <listitem>
385 <para>
386 is a tool for managing <application>Go</application> source code
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>
398 is a tool for formatting <application>Go</application> source code
399 </para>
400 <indexterm zone="gcc gofmt">
401 <primary sortas="b-gofmt">gofmt</primary>
402 </indexterm>
403 </listitem>
404 </varlistentry>
405 <!--
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>
411 language
412 </para>
413 <indexterm zone="gcc gdc">
414 <primary sortas="b-gdc">gdc</primary>
415 </indexterm>
416 </listitem>
417 </varlistentry>
418 -->
419 <varlistentry id="gfortran">
420 <term><command>gfortran</command></term>
421 <listitem>
422 <para>
423 is a GCC-based compiler for the <application>Fortran</application>
424 language
425 </para>
426 <indexterm zone="gcc gfortran">
427 <primary sortas="b-gfortran">gfortran</primary>
428 </indexterm>
429 </listitem>
430 </varlistentry>
431
432 </variablelist>
433
434 </sect2>
435
436</sect1>
Note: See TracBrowser for help on using the repository browser.