source: general/prog/gcc.xml@ 0e64979

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt nosym perl-modules 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 0e64979 was 0e64979, checked in by Pierre Labastie <pieere@…>, 8 years ago

change the command explanations in GCC for the new switch "gcc4-compatible"
and change instructions to use an in-tree build directory

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

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