source: general/prog/gcc.xml@ da8e9f9

10.0 10.1 11.0 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind ken/refactor-virt lazarus perl-modules qt5new trunk xry111/git-date xry111/git-date-for-trunk xry111/git-date-test
Last change on this file since da8e9f9 was da8e9f9, checked in by Thomas Trepl <thomas@…>, 4 years ago

Upgrade to gcc-7.3.0, gcc-ada-7.3.0

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

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