source: chapter06/gcc.xml@ 03084bc9

6.0
Last change on this file since 03084bc9 was 03084bc9, checked in by Matthew Burgess <matthew@…>, 20 years ago
  • Added gcc-3.4.1-linkonce-1.patch so as Mozilla and kdegraphics can be compiled successfully

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/testing/BOOK@4072 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 7.1 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
6<sect1 id="ch-system-gcc" xreflabel="GCC" role="wrap">
7<title>GCC-&gcc-version;</title>
8<?dbhtml filename="gcc.html"?>
9
10<indexterm zone="ch-system-gcc"><primary sortas="a-GCC">GCC</primary></indexterm>
11
12<sect2 role="package"><title/>
13<para>The GCC package contains the GNU compiler collection, which includes
14the C and C++ compilers.</para>
15
16<segmentedlist>
17<segtitle>&buildtime;</segtitle>
18<segtitle>&diskspace;</segtitle>
19<seglistitem><seg>11.7 SBU</seg><seg>294 MB</seg></seglistitem>
20</segmentedlist>
21
22<segmentedlist>
23<segtitle>GCC installation depends on</segtitle>
24<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, Findutils,
25Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, and Texinfo</seg></seglistitem>
26</segmentedlist>
27</sect2>
28
29<sect2 role="installation">
30<title>Installation of GCC</title>
31
32<para>This package is known to have issues when its default
33optimization flags (including the <parameter>-march</parameter> and
34<parameter>-mcpu</parameter> options) are changed. If any environment
35variables that override default optimizations have been defined, such
36as <emphasis>CFLAGS</emphasis> and <emphasis>CXXFLAGS</emphasis>,
37unset them when building GCC.</para>
38
39<para>Unpack both the gcc-core and the gcc-g++ tarballs&mdash;they will
40unpack into the same directory. Likewise, extract the gcc-testsuite
41package. The full GCC package contains additional compilers.
42Instructions for building these can be found at <ulink
43url="&blfs-root;view/stable/general/gcc.html"/>.</para>
44
45<para>Apply only the No-Fixincludes patch (not the Specs patch) also
46used in the previous chapter:</para>
47
48<screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes-1.patch</userinput></screen>
49
50<para>GCC fails to compile some packages outside of a base Linux From Scratch
51install (e.g., Mozilla and kdegraphics) when used in conjunction with newer
52versions of binutils. Apply the following patch to fix this issue:</para>
53
54<screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-linkonce-1.patch</userinput></screen>
55
56<para>Apply a sed substitution that will suppress the installation of
57<filename class="libraryfile">libiberty.a</filename>. The version of
58<filename class="libraryfile">libiberty.a</filename> provided by
59Binutils will be used instead:</para>
60
61<screen><userinput>sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
62
63<para>The GCC documentation recommends building GCC outside of the source
64directory in a dedicated build directory:</para>
65
66<screen><userinput>mkdir ../gcc-build
67cd ../gcc-build</userinput></screen>
68
69<para>Now prepare GCC for compilation:</para>
70
71<screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
72 --libexecdir=/usr/lib --enable-shared --enable-threads=posix \
73 --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++</userinput></screen>
74
75<para>Compile the package:</para>
76
77<screen><userinput>make</userinput></screen>
78
79<important><para>In this section, the test suite for GCC is considered
80critical. Do not skip it under any circumstance.</para></important>
81
82<para>Test the results, but do not stop at errors:</para>
83
84<screen><userinput>make -k check</userinput></screen>
85
86<para>Some of the errors are known issues and were noted in the
87previous chapter. The test suite notes from <xref
88linkend="ch-tools-gcc-pass2"/> are still relevant here. Be sure to
89refer back to them as necessary.</para>
90
91<para>Install the package:</para>
92
93<screen><userinput>make install</userinput></screen>
94
95<para>Some packages expect the C PreProcessor to be installed in the
96<filename class="directory">/lib</filename> directory.
97To support those packages, create this symlink:</para>
98
99<screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen>
100
101<para>Many packages use the name <command>cc</command> to call the C
102compiler. To satisfy those packages, create a symlink:</para>
103
104<screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen>
105
106<note><para>At this point, it is strongly recommended to repeat the
107sanity check performed earlier in this chapter. Refer back to <xref
108linkend="ch-system-readjusting"/> and repeat the check. If the results
109are in error, then the most likely reason is that the GCC Specs patch
110from <xref linkend="chapter-temporary-tools"/> was erroneously applied
111here.</para></note>
112
113</sect2>
114
115
116<sect2 id="contents-gcc" role="content"><title>Contents of GCC</title>
117
118<segmentedlist>
119<segtitle>Installed programs</segtitle>
120<segtitle>Installed libraries</segtitle>
121<seglistitem><seg>c++, cc (link to gcc),
122cc1, cc1plus, collect2, cpp, g++, gcc, gccbug, and gcov</seg>
123<seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so], and libsupc++.a</seg></seglistitem>
124</segmentedlist>
125
126<variablelist><bridgehead renderas="sect3">Short descriptions</bridgehead>
127<?dbfo list-presentation="list"?>
128
129<varlistentry id="cpp">
130<term><command>cpp</command></term>
131<listitem>
132<para>the C preprocessor. It is used by the compiler expand the
133#include, #define, and similar statements in the source files.</para>
134<indexterm zone="ch-system-gcc cpp"><primary sortas="b-cpp">cpp</primary></indexterm>
135</listitem>
136</varlistentry>
137
138<varlistentry id="g">
139<term><command>g++</command></term>
140<listitem>
141<para>the C++ compiler.</para>
142<indexterm zone="ch-system-gcc g"><primary sortas="b-g++">g++</primary></indexterm>
143</listitem>
144</varlistentry>
145
146<varlistentry id="gcc">
147<term><command>gcc</command></term>
148<listitem>
149<para>the C compiler.</para>
150<indexterm zone="ch-system-gcc gcc"><primary sortas="b-gcc">gcc</primary></indexterm>
151</listitem>
152</varlistentry>
153
154<varlistentry id="gccbug">
155<term><command>gccbug</command></term>
156<listitem>
157<para>a shell script used to help create useful bug reports.</para>
158<indexterm zone="ch-system-gcc gccbug"><primary sortas="b-gccbug">gccbug</primary></indexterm>
159</listitem>
160</varlistentry>
161
162<varlistentry id="gcov">
163<term><command>gcov</command></term>
164<listitem>
165<para>a coverage testing tool. It is used to analyze programs to
166determine where optimizations will have the most effect.</para>
167<indexterm zone="ch-system-gcc gcov"><primary sortas="b-gcov">gcov</primary></indexterm>
168</listitem>
169</varlistentry>
170
171<varlistentry id="libgcc">
172<term><filename class="libraryfile">libgcc*</filename></term>
173<listitem>
174<para>contains run-time support for <command>gcc</command>.</para>
175<indexterm zone="ch-system-gcc libgcc"><primary sortas="c-libgcc*">libgcc*</primary></indexterm>
176</listitem>
177</varlistentry>
178
179<varlistentry id="libstdc">
180<term><filename class="libraryfile">libstdc++</filename></term>
181<listitem>
182<para>the standard C++ library.</para>
183<indexterm zone="ch-system-gcc libstdc"><primary sortas="c-libstdc++">libstdc++</primary></indexterm>
184</listitem>
185</varlistentry>
186
187<varlistentry id="libsupc">
188<term><filename class="libraryfile">libsupc++</filename></term>
189<listitem>
190<para>provides supporting routines for the c++ programming language.</para>
191<indexterm zone="ch-system-gcc libsupc"><primary sortas="c-libsupc++">libsupc++</primary></indexterm>
192</listitem>
193</varlistentry>
194</variablelist>
195
196</sect2>
197
198</sect1>
199
Note: See TracBrowser for help on using the repository browser.