source: general/prog/gcc.xml@ 5ff8c3a

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 5ff8c3a was b984aaa1, checked in by Bruce Dubbs <bdubbs@…>, 20 months ago

More tags

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