1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
5 | %general-entities;
|
---|
6 | ]>
|
---|
7 |
|
---|
8 | <sect1 id="ch-system-gcc" role="wrap">
|
---|
9 | <?dbhtml filename="gcc.html"?>
|
---|
10 |
|
---|
11 | <title>GCC-&gcc-version;</title>
|
---|
12 |
|
---|
13 | <indexterm zone="ch-system-gcc">
|
---|
14 | <primary sortas="a-GCC">GCC</primary>
|
---|
15 | </indexterm>
|
---|
16 |
|
---|
17 | <sect2 role="package">
|
---|
18 | <title/>
|
---|
19 |
|
---|
20 | <para>The GCC package contains the GNU compiler collection, which includes
|
---|
21 | the C and C++ compilers.</para>
|
---|
22 |
|
---|
23 | <segmentedlist>
|
---|
24 | <segtitle>&buildtime;</segtitle>
|
---|
25 | <segtitle>&diskspace;</segtitle>
|
---|
26 |
|
---|
27 | <seglistitem>
|
---|
28 | <seg>&gcc-ch6-sbu;</seg>
|
---|
29 | <seg>&gcc-ch6-du;</seg>
|
---|
30 | </seglistitem>
|
---|
31 | </segmentedlist>
|
---|
32 |
|
---|
33 | </sect2>
|
---|
34 |
|
---|
35 | <sect2 role="installation">
|
---|
36 | <title>Installation of GCC</title>
|
---|
37 |
|
---|
38 | <para>Apply a <command>sed</command> substitution that will suppress the
|
---|
39 | installation of <filename class="libraryfile">libiberty.a</filename>. The
|
---|
40 | version of <filename class="libraryfile">libiberty.a</filename> provided by
|
---|
41 | Binutils will be used instead:</para>
|
---|
42 |
|
---|
43 | <screen><userinput>sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
|
---|
44 |
|
---|
45 | <para>The bootstrap build performed in <xref linkend="ch-tools-gcc-pass1"/>
|
---|
46 | built GCC with the <option>-fomit-frame-pointer</option> compiler flag.
|
---|
47 | Non-bootstrap builds omit this flag by default, so apply the following
|
---|
48 | <command>sed</command> to use it in order to ensure consistent compiler
|
---|
49 | builds.</para>
|
---|
50 |
|
---|
51 | <screen><userinput>sed -i 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in</userinput></screen>
|
---|
52 |
|
---|
53 | <para>The <command>fixincludes</command> script is known to occasionally
|
---|
54 | erroneously attempt to "fix" the system headers installed so far. As
|
---|
55 | the headers installed by GCC-&gcc-version; and Glibc-&glibc-version; are known
|
---|
56 | to not require fixing, issue the following command to prevent the
|
---|
57 | <command>fixincludes</command> script from running:</para>
|
---|
58 |
|
---|
59 | <screen><userinput>sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in</userinput></screen>
|
---|
60 |
|
---|
61 | <para>GCC provides a <command>gccbug</command> script which detects at
|
---|
62 | compile time whether mktemp is present, and hardcodes the result in a test.
|
---|
63 | This will cause the script to fall back to using less random names for
|
---|
64 | temporary files. We will be installing mktemp later, so the following sed
|
---|
65 | will simulate its presence.</para>
|
---|
66 |
|
---|
67 | <screen><userinput>sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in</userinput></screen>
|
---|
68 |
|
---|
69 | <para>The GCC documentation recommends building GCC outside of the source
|
---|
70 | directory in a dedicated build directory:</para>
|
---|
71 |
|
---|
72 | <screen><userinput>mkdir -v ../gcc-build
|
---|
73 | cd ../gcc-build</userinput></screen>
|
---|
74 |
|
---|
75 | <para>Prepare GCC for compilation:</para>
|
---|
76 |
|
---|
77 | <screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
|
---|
78 | --libexecdir=/usr/lib --enable-shared \
|
---|
79 | --enable-threads=posix --enable-__cxa_atexit \
|
---|
80 | --enable-clocale=gnu --enable-languages=c,c++</userinput></screen>
|
---|
81 |
|
---|
82 | <para>Compile the package:</para>
|
---|
83 |
|
---|
84 | <screen><userinput>make</userinput></screen>
|
---|
85 |
|
---|
86 | <important>
|
---|
87 | <para>In this section, the test suite for GCC is considered
|
---|
88 | critical. Do not skip it under any circumstance.</para>
|
---|
89 | </important>
|
---|
90 |
|
---|
91 | <para>Test the results, but do not stop at errors:</para>
|
---|
92 |
|
---|
93 | <screen><userinput>make -k check</userinput></screen>
|
---|
94 |
|
---|
95 | <para>Some of the errors are known issues and were noted in the
|
---|
96 | previous chapter. The test suite notes from <xref
|
---|
97 | linkend="ch-tools-gcc-pass2" role=","/> are still relevant here. Be sure to
|
---|
98 | refer back to them as necessary.</para>
|
---|
99 |
|
---|
100 | <para>Install the package:</para>
|
---|
101 |
|
---|
102 | <screen><userinput>make install</userinput></screen>
|
---|
103 |
|
---|
104 | <para>Some packages expect the C preprocessor to be installed in the
|
---|
105 | <filename class="directory">/lib</filename> directory.
|
---|
106 | To support those packages, create this symlink:</para>
|
---|
107 |
|
---|
108 | <screen><userinput>ln -sv ../usr/bin/cpp /lib</userinput></screen>
|
---|
109 |
|
---|
110 | <para>Many packages use the name <command>cc</command> to call the C
|
---|
111 | compiler. To satisfy those packages, create a symlink:</para>
|
---|
112 |
|
---|
113 | <screen><userinput>ln -sv gcc /usr/bin/cc</userinput></screen>
|
---|
114 |
|
---|
115 | <para>Now that our final toolchain is in place, it is important to again ensure
|
---|
116 | that compiling and linking will work as expected. We do this by performing
|
---|
117 | the same sanity checks as we did earlier in the chapter:</para>
|
---|
118 |
|
---|
119 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
120 | href="readjusting.xml"
|
---|
121 | xpointer="xpointer(//*[@os='a'])"/>
|
---|
122 |
|
---|
123 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
124 | href="readjusting.xml"
|
---|
125 | xpointer="xpointer(//*[@os='b'])"/>
|
---|
126 |
|
---|
127 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
128 | href="readjusting.xml"
|
---|
129 | xpointer="xpointer(//*[@os='c'])"/>
|
---|
130 |
|
---|
131 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
132 | href="readjusting.xml"
|
---|
133 | xpointer="xpointer(//*[@os='d'])"/>
|
---|
134 |
|
---|
135 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
136 | href="readjusting.xml"
|
---|
137 | xpointer="xpointer(//*[@os='e'])"/>
|
---|
138 |
|
---|
139 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
140 | href="readjusting.xml"
|
---|
141 | xpointer="xpointer(//*[@os='f'])"/>
|
---|
142 |
|
---|
143 | <screen><computeroutput>/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crt1.o succeeded
|
---|
144 | /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crti.o succeeded
|
---|
145 | /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crtn.o succeeded</computeroutput></screen>
|
---|
146 |
|
---|
147 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
148 | href="readjusting.xml"
|
---|
149 | xpointer="xpointer(//*[@os='g'])"/>
|
---|
150 |
|
---|
151 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
152 | href="readjusting.xml"
|
---|
153 | xpointer="xpointer(//*[@os='h'])"/>
|
---|
154 |
|
---|
155 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
156 | href="readjusting.xml"
|
---|
157 | xpointer="xpointer(//*[@os='i'])"/>
|
---|
158 |
|
---|
159 | <screen><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
|
---|
160 | SEARCH_DIR("/usr/local/lib")
|
---|
161 | SEARCH_DIR("/lib")
|
---|
162 | SEARCH_DIR("/usr/lib");</computeroutput></screen>
|
---|
163 |
|
---|
164 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
165 | href="readjusting.xml"
|
---|
166 | xpointer="xpointer(//*[@os='j'])"/>
|
---|
167 |
|
---|
168 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
169 | href="readjusting.xml"
|
---|
170 | xpointer="xpointer(//*[@os='k'])"/>
|
---|
171 |
|
---|
172 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
173 | href="readjusting.xml"
|
---|
174 | xpointer="xpointer(//*[@os='l'])"/>
|
---|
175 |
|
---|
176 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
177 | href="readjusting.xml"
|
---|
178 | xpointer="xpointer(//*[@os='m'])"/>
|
---|
179 |
|
---|
180 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
181 | href="readjusting.xml"
|
---|
182 | xpointer="xpointer(//*[@os='n'])"/>
|
---|
183 |
|
---|
184 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
185 | href="readjusting.xml"
|
---|
186 | xpointer="xpointer(//*[@os='o'])"/>
|
---|
187 |
|
---|
188 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
189 | href="readjusting.xml"
|
---|
190 | xpointer="xpointer(//*[@os='p'])"/>
|
---|
191 |
|
---|
192 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
193 | href="readjusting.xml"
|
---|
194 | xpointer="xpointer(//*[@os='q'])"/>
|
---|
195 |
|
---|
196 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
197 | href="readjusting.xml"
|
---|
198 | xpointer="xpointer(//*[@os='r'])"/>
|
---|
199 |
|
---|
200 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
201 | href="readjusting.xml"
|
---|
202 | xpointer="xpointer(//*[@os='s'])"/>
|
---|
203 |
|
---|
204 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
205 | href="readjusting.xml"
|
---|
206 | xpointer="xpointer(//*[@os='t'])"/>
|
---|
207 |
|
---|
208 | </sect2>
|
---|
209 |
|
---|
210 | <sect2 id="contents-gcc" role="content">
|
---|
211 | <title>Contents of GCC</title>
|
---|
212 |
|
---|
213 | <segmentedlist>
|
---|
214 | <segtitle>Installed programs</segtitle>
|
---|
215 | <segtitle>Installed libraries</segtitle>
|
---|
216 |
|
---|
217 | <seglistitem>
|
---|
218 | <seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcov</seg>
|
---|
219 | <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.{a,so}, and
|
---|
220 | libsupc++.a</seg>
|
---|
221 | </seglistitem>
|
---|
222 | </segmentedlist>
|
---|
223 |
|
---|
224 | <variablelist>
|
---|
225 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
226 | <?dbfo list-presentation="list"?>
|
---|
227 | <?dbhtml list-presentation="table"?>
|
---|
228 |
|
---|
229 | <varlistentry id="cc">
|
---|
230 | <term><command>cc</command></term>
|
---|
231 | <listitem>
|
---|
232 | <para>The C compiler</para>
|
---|
233 | <indexterm zone="ch-system-gcc cc">
|
---|
234 | <primary sortas="b-cc">cc</primary>
|
---|
235 | </indexterm>
|
---|
236 | </listitem>
|
---|
237 | </varlistentry>
|
---|
238 |
|
---|
239 | <varlistentry id="cpp">
|
---|
240 | <term><command>cpp</command></term>
|
---|
241 | <listitem>
|
---|
242 | <para>The C preprocessor; it is used by the compiler to expand the
|
---|
243 | #include, #define, and similar statements in the source files</para>
|
---|
244 | <indexterm zone="ch-system-gcc cpp">
|
---|
245 | <primary sortas="b-cpp">cpp</primary>
|
---|
246 | </indexterm>
|
---|
247 | </listitem>
|
---|
248 | </varlistentry>
|
---|
249 |
|
---|
250 | <varlistentry id="c">
|
---|
251 | <term><command>c++</command></term>
|
---|
252 | <listitem>
|
---|
253 | <para>The C++ compiler</para>
|
---|
254 | <indexterm zone="ch-system-gcc c">
|
---|
255 | <primary sortas="b-c++">c++</primary>
|
---|
256 | </indexterm>
|
---|
257 | </listitem>
|
---|
258 | </varlistentry>
|
---|
259 |
|
---|
260 | <varlistentry id="g">
|
---|
261 | <term><command>g++</command></term>
|
---|
262 | <listitem>
|
---|
263 | <para>The C++ compiler</para>
|
---|
264 | <indexterm zone="ch-system-gcc g">
|
---|
265 | <primary sortas="b-g++">g++</primary>
|
---|
266 | </indexterm>
|
---|
267 | </listitem>
|
---|
268 | </varlistentry>
|
---|
269 |
|
---|
270 | <varlistentry id="gcc">
|
---|
271 | <term><command>gcc</command></term>
|
---|
272 | <listitem>
|
---|
273 | <para>The C compiler</para>
|
---|
274 | <indexterm zone="ch-system-gcc gcc">
|
---|
275 | <primary sortas="b-gcc">gcc</primary>
|
---|
276 | </indexterm>
|
---|
277 | </listitem>
|
---|
278 | </varlistentry>
|
---|
279 |
|
---|
280 | <varlistentry id="gccbug">
|
---|
281 | <term><command>gccbug</command></term>
|
---|
282 | <listitem>
|
---|
283 | <para>A shell script used to help create useful bug reports</para>
|
---|
284 | <indexterm zone="ch-system-gcc gccbug">
|
---|
285 | <primary sortas="b-gccbug">gccbug</primary>
|
---|
286 | </indexterm>
|
---|
287 | </listitem>
|
---|
288 | </varlistentry>
|
---|
289 |
|
---|
290 | <varlistentry id="gcov">
|
---|
291 | <term><command>gcov</command></term>
|
---|
292 | <listitem>
|
---|
293 | <para>A coverage testing tool; it is used to analyze programs to
|
---|
294 | determine where optimizations will have the most effect</para>
|
---|
295 | <indexterm zone="ch-system-gcc gcov">
|
---|
296 | <primary sortas="b-gcov">gcov</primary>
|
---|
297 | </indexterm>
|
---|
298 | </listitem>
|
---|
299 | </varlistentry>
|
---|
300 |
|
---|
301 | <varlistentry id="libgcc">
|
---|
302 | <term><filename class="libraryfile">libgcc</filename></term>
|
---|
303 | <listitem>
|
---|
304 | <para>Contains run-time support for <command>gcc</command></para>
|
---|
305 | <indexterm zone="ch-system-gcc libgcc">
|
---|
306 | <primary sortas="c-libgcc*">libgcc*</primary>
|
---|
307 | </indexterm>
|
---|
308 | </listitem>
|
---|
309 | </varlistentry>
|
---|
310 |
|
---|
311 | <varlistentry id="libstdc">
|
---|
312 | <term><filename class="libraryfile">libstdc++</filename></term>
|
---|
313 | <listitem>
|
---|
314 | <para>The standard C++ library</para>
|
---|
315 | <indexterm zone="ch-system-gcc libstdc">
|
---|
316 | <primary sortas="c-libstdc++">libstdc++</primary>
|
---|
317 | </indexterm>
|
---|
318 | </listitem>
|
---|
319 | </varlistentry>
|
---|
320 |
|
---|
321 | <varlistentry id="libsupc">
|
---|
322 | <term><filename class="libraryfile">libsupc++</filename></term>
|
---|
323 | <listitem>
|
---|
324 | <para>Provides supporting routines for the C++ programming
|
---|
325 | language</para>
|
---|
326 | <indexterm zone="ch-system-gcc libsupc">
|
---|
327 | <primary sortas="c-libsupc++">libsupc++</primary>
|
---|
328 | </indexterm>
|
---|
329 | </listitem>
|
---|
330 | </varlistentry>
|
---|
331 |
|
---|
332 | </variablelist>
|
---|
333 |
|
---|
334 | </sect2>
|
---|
335 |
|
---|
336 | </sect1>
|
---|