source: general/prog/gcc.xml@ f4002c5

10.0 10.1 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 f4002c5 was f4002c5, checked in by Bruce Dubbs <bdubbs@…>, 4 years ago

Archive expect, dejagnu, and tcl which are now included in LFS.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@23319 af4574ff-66df-0310-9fd7-8a98e5e911e0

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