source: general/prog/gcc.xml@ 9a72f67

systemd-13485
Last change on this file since 9a72f67 was 65336f2, checked in by Christopher Gregory <cjg@…>, 10 years ago

Merged gcc and imagemagic updates from trunk.

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

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