source: general/prog/gcc.xml@ c193fbe

7.6-blfs 7.6-systemd kde5-14269 kde5-14686 systemd-13485
Last change on this file since c193fbe was c193fbe, checked in by Krejzi <krejzi@…>, 10 years ago

Mark gcc as checked.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/branches/systemd@13999 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 12.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://ftp.gnu.org/gnu/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 "fddf71348546af523353bd43d34919c1">
10 <!ENTITY gcc-size "86 MB">
11 <!ENTITY gcc-buildsize "5.1 GB">
12 <!ENTITY gcc-time "145 SBU">
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-4-0">GCC-&gcc-version;</primary>
27 </indexterm>
28
29 <sect2 role="package">
30 <title>Introduction to GCC</title>
31
32 <para>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++, Fortran, Objective C, Objective C++, and Go.
35 Two additional languages , Ada and Java are available in the collection.
36 They have specific requirements, so they are described in separate pages
37 (<xref linkend="gcc-ada"/> and <xref linkend="gcc-java"/>). Since C and
38 C++ are installed in LFS, this page is either for upgrading C and C++,
39 or for installing additional compilers.</para>
40
41 &lfs76_checked;
42
43 <caution>
44 <para>If you are upgrading <application>GCC</application> from any other
45 version prior to &gcc-version;, then you must be careful compiling 3rd
46 party kernel modules. You should ensure that the kernel and all its
47 native modules are also compiled using the same version of
48 <application>GCC</application> that you use to build the 3rd party module.
49 This issue does not affect native kernel (and kernel modules) updates,
50 as the instructions below are a complete reinstallation of
51 <application>GCC</application>. If you have existing 3rd party modules
52 installed, ensure they are recompiled using the updated version of
53 <application>GCC</application>. As always, never update the kernel
54 headers from the ones used when <application>Glibc</application> was
55 compiled during LFS.</para>
56 </caution>
57
58 <bridgehead renderas="sect3">Package Information</bridgehead>
59 <itemizedlist spacing="compact">
60 <listitem>
61 <para>Download (HTTP): <ulink url="&gcc-download-http;"/></para>
62 </listitem>
63 <listitem>
64 <para>Download (FTP): <ulink url="&gcc-download-ftp;"/></para>
65 </listitem>
66 <listitem>
67 <para>Download MD5 sum: &gcc-md5sum;</para>
68 </listitem>
69 <listitem>
70 <para>Download size: &gcc-size;</para>
71 </listitem>
72 <listitem>
73 <para>Estimated disk space required: &gcc-buildsize;</para>
74 </listitem>
75 <listitem>
76 <para>Estimated build time: &gcc-time;</para>
77 </listitem>
78 </itemizedlist>
79
80<!-- <bridgehead renderas="sect3">Additional Downloads</bridgehead>
81 <itemizedlist spacing="compact">
82 <listitem>
83 <para>
84 Required patch:
85 <ulink url="&patch-root;/gcc-&gcc-version;-upstream_fixes-1.patch"/>
86 </para>
87 </listitem>
88 </itemizedlist>
89-->
90 <bridgehead renderas="sect3">GCC Dependencies</bridgehead>
91
92 <bridgehead renderas="sect4">Recommended</bridgehead>
93 <para role="recommended">
94 <xref linkend="dejagnu"/>, for tests
95 </para>
96
97 <para condition="html" role="usernotes">User Notes:
98 <ulink url="&blfs-wiki;/gcc"/></para>
99
100 </sect2>
101
102 <sect2 role="installation">
103 <title>Installation of GCC</title>
104
105 <important>
106 <para>Even if you specify only languages other than C and C++ to the
107 <command>./configure</command> command below, the
108 installation process will overwrite your existing
109 <application>GCC</application> C and C++ compilers and libraries.
110 Having the <application>Tcl</application>,
111 <application>Expect</application> and <application>DejaGnu</application>
112 packages installed before beginning the build is highly recommended so
113 you can run the full suite of tests.</para>
114
115 <para>Do not continue with the <command>make install</command> command
116 until you are confident the build was successful. You can compare your
117 test results with those found at <ulink
118 url="http://gcc.gnu.org/ml/gcc-testresults/"/>. You may also want to
119 refer to the information found in the <application>GCC</application>
120 section of Chapter 6 in the LFS book (<ulink
121 url="&lfs-root;/chapter06/gcc.html"/>).</para>
122 </important>
123
124 <para>The instructions below are intentionally performing a
125 <quote>bootstrap</quote> process. Bootstrapping is needed for robustness
126 and is highly recommended when upgrading the compilers version. To disable
127 bootstrap anyways, add <parameter>--disable-bootstrap</parameter> to the
128 <command>./configure</command> options below.</para>
129
130 <para>As in LFS, fix a problem identified upstream:</para>
131
132<screen><userinput>sed -i 's/if \((code.*))\)/if (\1 \&amp;\&amp; \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>
133
134 <para>Install <application>GCC</application> by running the
135 following commands:</para>
136
137<screen><userinput><!--patch -Np1 -i ../gcc-&gcc-version;-upstream_fixes-1.patch &amp;&amp;
138-->mkdir ../gcc-build &amp;&amp;
139cd ../gcc-build &amp;&amp;
140
141../gcc-&gcc-version;/configure \
142 --prefix=/usr \
143 --disable-multilib \
144 --with-system-zlib \
145 --enable-languages=c,c++,fortran,go,objc,obj-c++ &amp;&amp;
146make</userinput></screen>
147
148 <para>If you have installed additional packages such as
149 <application>Valgrind</application> and <application>GDB</application>,
150 the <application>GCC</application> part of the testsuite will run more
151 tests than in LFS. Some of those will report FAIL and others XPASS
152 (pass when expected to FAIL). To run the tests, issue:</para>
153
154<screen><userinput>ulimit -s 32768 &amp;&amp;
155make -k check</userinput></screen>
156<!-- The command above may error out, so using && may prevent the summary
157to be run. -->
158
159 <para>The tests are very long, and the results may be hard to find in the
160 logs, specially if you use parallel jobs with make. You can get a summary
161 of the tests with:</para>
162
163<screen><userinput>../gcc-&gcc-version;/contrib/test_summary</userinput></screen>
164
165 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
166
167<screen role="root"><userinput>make install &amp;&amp;
168
169mkdir -pv /usr/share/gdb/auto-load/usr/lib &amp;&amp;
170mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib &amp;&amp;
171
172chown -v -R root:root \
173 /usr/lib/gcc/*linux-gnu/&gcc-version;/include{,-fixed}</userinput></screen>
174
175 <para>Some packages expect to find the C preprocessor in
176 <filename class="directory">/lib</filename> or may refer to the C compiler
177 under the name <command>cc</command>. The following symbolic links are not
178 needed if you have followed the LFS instructions, since they
179 have been already created. If you do not have them on your system, issue
180 as the <systemitem class="username">root</systemitem> user:</para>
181
182<screen role="root"><userinput>ln -v -sf ../usr/bin/cpp /lib &amp;&amp;
183ln -v -sf gcc /usr/bin/cc</userinput></screen>
184
185 </sect2>
186
187 <sect2 role="commands">
188 <title>Command Explanations</title>
189
190 <para>
191 <command>mkdir ../gcc-build; cd ../gcc-build</command>: The
192 <application>GCC</application> documentation recommends
193 building the package in a dedicated build directory.
194 </para>
195
196 <para>
197 <parameter>--disable-multilib</parameter>: This parameter ensures
198 that files are created for the specific architecture of your computer.
199 </para>
200
201 <para>
202 <parameter>--with-system-zlib</parameter>: Uses the system
203 <application>zlib</application> instead of the bundled one.
204 <application>zlib</application> is used for compressing
205 and uncompressing <application>GCC</application>'s intermediate
206 language in LTO (Link Time Optimization) object files.
207 </para>
208
209 <para>
210 <parameter>--enable-languages=c,c++,fortran,go,objc,obj-c++</parameter>:
211 This command identifies which languages to build. You may modify
212 this command to remove undesired languages.
213 </para>
214
215 <para>
216 <command>ulimit -s 32768</command>: This command prevents several
217 tests from running out of stack space.
218 </para>
219
220 <para>
221 <command>make -k check</command>: This command runs the test suite
222 without stopping if any errors are encountered.
223 </para>
224
225 <para>
226 <command>../gcc-&gcc-version;/contrib/test_summary</command>: This
227 command will produce a summary of the test suite results. You can append
228 <command>| grep -A7 Summ</command> to the command to produce an even more
229 condensed version of the summary. You may also wish to redirect the output
230 to a file for review and comparison later on.
231 </para>
232
233 <para>
234 <command>mv -v /usr/lib/*gdb.py ...</command>: The installation
235 stage puts some files used by <application>gdb</application> under the
236 <filename class="directory">/usr/lib</filename> directory. This generates
237 spurious error messages when performing <command>ldconfig</command>. This
238 command moves the files to another location.
239 </para>
240
241 <para>
242 <command>chown -v -R root:root /usr/lib/gcc/*linux-gnu/...</command>:
243 If the package is built by a user other than root, the ownership of the
244 installed <filename class="directory">include</filename> directory (and
245 its content) will be incorrect. This command changes the ownership to the
246 <systemitem class="username">root</systemitem> user and group.
247 </para>
248
249 </sect2>
250
251 <sect2 role="content">
252 <title>Contents</title>
253
254 <para>Some program and library names and descriptions are not listed here,
255 but can be found at
256 <ulink url="&lfs-root;/chapter06/gcc.html#contents-gcc"/> as they were
257 initially installed during the building of LFS.</para>
258
259 <segmentedlist>
260 <segtitle>Installed Programs</segtitle>
261 <segtitle>Installed Libraries</segtitle>
262 <segtitle>Installed Directories</segtitle>
263
264 <seglistitem>
265 <seg>
266 gccgo and gfortran,
267 hard-linked to architecture specific names
268 </seg>
269 <seg>
270 libgfortran.{so,a},
271 libgo.{so,a}, libgobegin.a, libobjc.{so,a}, and numerous other
272 run-time libraries and executables in <filename class="directory">
273 /usr/lib/gcc</filename> and <filename class="directory">
274 /usr/libexec/gcc</filename>
275 </seg>
276 <seg>
277 /usr/lib/gcc/&lt;arch-triplet&gt;/&gcc-version;/include/objc and
278 /usr/lib/go
279 </seg>
280 </seglistitem>
281 </segmentedlist>
282
283 <variablelist>
284 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
285 <?dbfo list-presentation="list"?>
286 <?dbhtml list-presentation="table"?>
287
288 <varlistentry id="gccgo">
289 <term><command>gccgo</command></term>
290 <listitem>
291 <para>is a GCC-based compiler for the
292 <application>Go</application> language.</para>
293 <indexterm zone="gcc gccgo">
294 <primary sortas="b-gccgo">gccgo</primary>
295 </indexterm>
296 </listitem>
297 </varlistentry>
298
299 <varlistentry id="gfortran">
300 <term><command>gfortran</command></term>
301 <listitem>
302 <para>is a GCC-based compiler for the
303 <application>Fortran</application> language.</para>
304 <indexterm zone="gcc gfortran">
305 <primary sortas="b-gfortran">gfortran</primary>
306 </indexterm>
307 </listitem>
308 </varlistentry>
309
310 </variablelist>
311
312 </sect2>
313
314</sect1>
Note: See TracBrowser for help on using the repository browser.