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