source: general/prog/gcc.xml@ e9b9a70

11.0 11.1 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 upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since e9b9a70 was 45ab6c7, checked in by Xi Ruoyao <xry111@…>, 3 years ago

more SVN prop clean up

Remove "$LastChanged$" everywhere, and also some unused $Date$

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