[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[b06ca36] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[673b0d8] | 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
[6a82dd9] | 7 |
|
---|
[81fd230] | 8 | <sect1 id="ch-system-gcc" role="wrap">
|
---|
[6a82dd9] | 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/>
|
---|
[6370fa6] | 19 |
|
---|
[6a82dd9] | 20 | <para>The GCC package contains the GNU compiler collection, which includes
|
---|
| 21 | the C and C++ compilers.</para>
|
---|
[673b0d8] | 22 |
|
---|
[6a82dd9] | 23 | <segmentedlist>
|
---|
| 24 | <segtitle>&buildtime;</segtitle>
|
---|
| 25 | <segtitle>&diskspace;</segtitle>
|
---|
[5888299] | 26 |
|
---|
[6a82dd9] | 27 | <seglistitem>
|
---|
[e4a5635] | 28 | <seg>&gcc-ch6-sbu;</seg>
|
---|
| 29 | <seg>&gcc-ch6-du;</seg>
|
---|
[6a82dd9] | 30 | </seglistitem>
|
---|
| 31 | </segmentedlist>
|
---|
[3554fa3a] | 32 |
|
---|
[6a82dd9] | 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>
|
---|
[37dcf2a] | 42 |
|
---|
| 43 | <screen><userinput>sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
|
---|
[73aedd1d] | 44 |
|
---|
[6a82dd9] | 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>
|
---|
[2e02c35] | 50 |
|
---|
| 51 | <screen><userinput>sed -i 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in</userinput></screen>
|
---|
| 52 |
|
---|
[6a82dd9] | 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>
|
---|
[27ced84] | 58 |
|
---|
| 59 | <screen><userinput>sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in</userinput></screen>
|
---|
| 60 |
|
---|
[6a82dd9] | 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>
|
---|
[3154d10b] | 66 |
|
---|
[7660d67] | 67 | <screen><userinput>sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in</userinput></screen>
|
---|
[3154d10b] | 68 |
|
---|
[6a82dd9] | 69 | <para>The GCC documentation recommends building GCC outside of the source
|
---|
| 70 | directory in a dedicated build directory:</para>
|
---|
[73aedd1d] | 71 |
|
---|
[5998892] | 72 | <screen><userinput>mkdir -v ../gcc-build
|
---|
[73aedd1d] | 73 | cd ../gcc-build</userinput></screen>
|
---|
| 74 |
|
---|
[6a82dd9] | 75 | <para>Prepare GCC for compilation:</para>
|
---|
[73aedd1d] | 76 |
|
---|
[673b0d8] | 77 | <screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
|
---|
[d72e04a] | 78 | --libexecdir=/usr/lib --enable-shared \
|
---|
| 79 | --enable-threads=posix --enable-__cxa_atexit \
|
---|
| 80 | --enable-clocale=gnu --enable-languages=c,c++</userinput></screen>
|
---|
[73aedd1d] | 81 |
|
---|
[6a82dd9] | 82 | <para>Compile the package:</para>
|
---|
[73aedd1d] | 83 |
|
---|
| 84 | <screen><userinput>make</userinput></screen>
|
---|
| 85 |
|
---|
[6a82dd9] | 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>
|
---|
[81fd230] | 90 |
|
---|
[6a82dd9] | 91 | <para>Test the results, but do not stop at errors:</para>
|
---|
[73aedd1d] | 92 |
|
---|
| 93 | <screen><userinput>make -k check</userinput></screen>
|
---|
| 94 |
|
---|
[9278974d] | 95 | <para>To receive a summary of the test suite results, run:</para>
|
---|
| 96 |
|
---|
| 97 | <screen><userinput>../gcc-&gcc-version;/contrib/test_summary</userinput></screen>
|
---|
| 98 |
|
---|
| 99 | <para>For only the summaries, pipe the output through
|
---|
| 100 | <userinput>grep -A7 Summ</userinput>.</para>
|
---|
| 101 |
|
---|
| 102 | <para>Results can be compared with those located at <ulink
|
---|
| 103 | url="&test-results;"/>.</para>
|
---|
| 104 |
|
---|
| 105 | <para>A few unexpected failures cannot always be avoided. The GCC developers
|
---|
| 106 | are usually aware of these issues, but have not resolved them yet. In
|
---|
| 107 | particular, the <filename class="libraryfile">libmudflap</filename> tests
|
---|
| 108 | are known be particularly problematic as a result of a bug in GCC
|
---|
| 109 | (<ulink url="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20003"/>).
|
---|
| 110 | Unless the test results are vastly different from those at the above URL,
|
---|
| 111 | it is safe to continue.</para>
|
---|
[73aedd1d] | 112 |
|
---|
[6a82dd9] | 113 | <para>Install the package:</para>
|
---|
[73aedd1d] | 114 |
|
---|
| 115 | <screen><userinput>make install</userinput></screen>
|
---|
| 116 |
|
---|
[6a82dd9] | 117 | <para>Some packages expect the C preprocessor to be installed in the
|
---|
| 118 | <filename class="directory">/lib</filename> directory.
|
---|
| 119 | To support those packages, create this symlink:</para>
|
---|
[73aedd1d] | 120 |
|
---|
[5998892] | 121 | <screen><userinput>ln -sv ../usr/bin/cpp /lib</userinput></screen>
|
---|
[73aedd1d] | 122 |
|
---|
[6a82dd9] | 123 | <para>Many packages use the name <command>cc</command> to call the C
|
---|
| 124 | compiler. To satisfy those packages, create a symlink:</para>
|
---|
[1ba726f] | 125 |
|
---|
| 126 | <screen><userinput>ln -sv gcc /usr/bin/cc</userinput></screen>
|
---|
| 127 |
|
---|
[09f1daf] | 128 | <para>Now that our final toolchain is in place, it is important to again ensure
|
---|
| 129 | that compiling and linking will work as expected. We do this by performing
|
---|
| 130 | the same sanity checks as we did earlier in the chapter:</para>
|
---|
| 131 |
|
---|
| 132 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 133 | href="readjusting.xml"
|
---|
| 134 | xpointer="xpointer(//*[@os='a'])"/>
|
---|
| 135 |
|
---|
| 136 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 137 | href="readjusting.xml"
|
---|
| 138 | xpointer="xpointer(//*[@os='b'])"/>
|
---|
| 139 |
|
---|
| 140 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 141 | href="readjusting.xml"
|
---|
| 142 | xpointer="xpointer(//*[@os='c'])"/>
|
---|
| 143 |
|
---|
| 144 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 145 | href="readjusting.xml"
|
---|
| 146 | xpointer="xpointer(//*[@os='d'])"/>
|
---|
| 147 |
|
---|
| 148 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 149 | href="readjusting.xml"
|
---|
| 150 | xpointer="xpointer(//*[@os='e'])"/>
|
---|
| 151 |
|
---|
| 152 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 153 | href="readjusting.xml"
|
---|
| 154 | xpointer="xpointer(//*[@os='f'])"/>
|
---|
| 155 |
|
---|
| 156 | <screen><computeroutput>/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crt1.o succeeded
|
---|
| 157 | /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crti.o succeeded
|
---|
| 158 | /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/../../../crtn.o succeeded</computeroutput></screen>
|
---|
| 159 |
|
---|
| 160 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 161 | href="readjusting.xml"
|
---|
| 162 | xpointer="xpointer(//*[@os='g'])"/>
|
---|
| 163 |
|
---|
[0a6f214] | 164 | <screen><userinput>grep -B3 '^ /usr/include' dummy.log</userinput></screen>
|
---|
[e9a652b] | 165 |
|
---|
[09f1daf] | 166 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 167 | href="readjusting.xml"
|
---|
| 168 | xpointer="xpointer(//*[@os='h'])"/>
|
---|
| 169 |
|
---|
[e9a652b] | 170 | <screen><computeroutput>#include <...> search starts here:
|
---|
[0a6f214] | 171 | /usr/local/include
|
---|
[e9a652b] | 172 | /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/include
|
---|
| 173 | /usr/include</computeroutput></screen>
|
---|
| 174 |
|
---|
[09f1daf] | 175 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 176 | href="readjusting.xml"
|
---|
| 177 | xpointer="xpointer(//*[@os='i'])"/>
|
---|
| 178 |
|
---|
| 179 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 180 | href="readjusting.xml"
|
---|
| 181 | xpointer="xpointer(//*[@os='j'])"/>
|
---|
| 182 |
|
---|
| 183 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 184 | href="readjusting.xml"
|
---|
| 185 | xpointer="xpointer(//*[@os='k'])"/>
|
---|
| 186 |
|
---|
[e9a652b] | 187 | <screen><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
|
---|
| 188 | SEARCH_DIR("/usr/local/lib")
|
---|
| 189 | SEARCH_DIR("/lib")
|
---|
| 190 | SEARCH_DIR("/usr/lib");</computeroutput></screen>
|
---|
| 191 |
|
---|
[09f1daf] | 192 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 193 | href="readjusting.xml"
|
---|
| 194 | xpointer="xpointer(//*[@os='l'])"/>
|
---|
| 195 |
|
---|
| 196 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 197 | href="readjusting.xml"
|
---|
| 198 | xpointer="xpointer(//*[@os='m'])"/>
|
---|
| 199 |
|
---|
| 200 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 201 | href="readjusting.xml"
|
---|
| 202 | xpointer="xpointer(//*[@os='n'])"/>
|
---|
| 203 |
|
---|
| 204 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 205 | href="readjusting.xml"
|
---|
| 206 | xpointer="xpointer(//*[@os='o'])"/>
|
---|
| 207 |
|
---|
| 208 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 209 | href="readjusting.xml"
|
---|
| 210 | xpointer="xpointer(//*[@os='p'])"/>
|
---|
| 211 |
|
---|
| 212 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 213 | href="readjusting.xml"
|
---|
| 214 | xpointer="xpointer(//*[@os='q'])"/>
|
---|
| 215 |
|
---|
| 216 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 217 | href="readjusting.xml"
|
---|
| 218 | xpointer="xpointer(//*[@os='r'])"/>
|
---|
| 219 |
|
---|
| 220 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 221 | href="readjusting.xml"
|
---|
| 222 | xpointer="xpointer(//*[@os='s'])"/>
|
---|
| 223 |
|
---|
| 224 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 225 | href="readjusting.xml"
|
---|
| 226 | xpointer="xpointer(//*[@os='t'])"/>
|
---|
[6a82dd9] | 227 |
|
---|
[e9a652b] | 228 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 229 | href="readjusting.xml"
|
---|
| 230 | xpointer="xpointer(//*[@os='u'])"/>
|
---|
| 231 |
|
---|
| 232 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 233 | href="readjusting.xml"
|
---|
| 234 | xpointer="xpointer(//*[@os='v'])"/>
|
---|
| 235 |
|
---|
[6a82dd9] | 236 | </sect2>
|
---|
| 237 |
|
---|
| 238 | <sect2 id="contents-gcc" role="content">
|
---|
| 239 | <title>Contents of GCC</title>
|
---|
| 240 |
|
---|
| 241 | <segmentedlist>
|
---|
| 242 | <segtitle>Installed programs</segtitle>
|
---|
| 243 | <segtitle>Installed libraries</segtitle>
|
---|
| 244 |
|
---|
| 245 | <seglistitem>
|
---|
| 246 | <seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcov</seg>
|
---|
[2791a8e] | 247 | <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libmudflap.{a,so},
|
---|
| 248 | libssp.{a,so}libstdc++.{a,so}, and libsupc++.a</seg>
|
---|
[6a82dd9] | 249 | </seglistitem>
|
---|
| 250 | </segmentedlist>
|
---|
| 251 |
|
---|
| 252 | <variablelist>
|
---|
| 253 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 254 | <?dbfo list-presentation="list"?>
|
---|
| 255 | <?dbhtml list-presentation="table"?>
|
---|
| 256 |
|
---|
[75128571] | 257 | <varlistentry id="c">
|
---|
| 258 | <term><command>c++</command></term>
|
---|
| 259 | <listitem>
|
---|
| 260 | <para>The C++ compiler</para>
|
---|
| 261 | <indexterm zone="ch-system-gcc c">
|
---|
| 262 | <primary sortas="b-c++">c++</primary>
|
---|
| 263 | </indexterm>
|
---|
| 264 | </listitem>
|
---|
| 265 | </varlistentry>
|
---|
| 266 |
|
---|
[6a82dd9] | 267 | <varlistentry id="cc">
|
---|
| 268 | <term><command>cc</command></term>
|
---|
| 269 | <listitem>
|
---|
| 270 | <para>The C compiler</para>
|
---|
| 271 | <indexterm zone="ch-system-gcc cc">
|
---|
| 272 | <primary sortas="b-cc">cc</primary>
|
---|
| 273 | </indexterm>
|
---|
| 274 | </listitem>
|
---|
| 275 | </varlistentry>
|
---|
| 276 |
|
---|
| 277 | <varlistentry id="cpp">
|
---|
| 278 | <term><command>cpp</command></term>
|
---|
| 279 | <listitem>
|
---|
| 280 | <para>The C preprocessor; it is used by the compiler to expand the
|
---|
| 281 | #include, #define, and similar statements in the source files</para>
|
---|
| 282 | <indexterm zone="ch-system-gcc cpp">
|
---|
| 283 | <primary sortas="b-cpp">cpp</primary>
|
---|
| 284 | </indexterm>
|
---|
| 285 | </listitem>
|
---|
| 286 | </varlistentry>
|
---|
| 287 |
|
---|
| 288 | <varlistentry id="g">
|
---|
| 289 | <term><command>g++</command></term>
|
---|
| 290 | <listitem>
|
---|
| 291 | <para>The C++ compiler</para>
|
---|
| 292 | <indexterm zone="ch-system-gcc g">
|
---|
| 293 | <primary sortas="b-g++">g++</primary>
|
---|
| 294 | </indexterm>
|
---|
| 295 | </listitem>
|
---|
| 296 | </varlistentry>
|
---|
| 297 |
|
---|
| 298 | <varlistentry id="gcc">
|
---|
| 299 | <term><command>gcc</command></term>
|
---|
| 300 | <listitem>
|
---|
| 301 | <para>The C compiler</para>
|
---|
| 302 | <indexterm zone="ch-system-gcc gcc">
|
---|
| 303 | <primary sortas="b-gcc">gcc</primary>
|
---|
| 304 | </indexterm>
|
---|
| 305 | </listitem>
|
---|
| 306 | </varlistentry>
|
---|
| 307 |
|
---|
| 308 | <varlistentry id="gccbug">
|
---|
| 309 | <term><command>gccbug</command></term>
|
---|
| 310 | <listitem>
|
---|
| 311 | <para>A shell script used to help create useful bug reports</para>
|
---|
| 312 | <indexterm zone="ch-system-gcc gccbug">
|
---|
| 313 | <primary sortas="b-gccbug">gccbug</primary>
|
---|
| 314 | </indexterm>
|
---|
| 315 | </listitem>
|
---|
| 316 | </varlistentry>
|
---|
| 317 |
|
---|
| 318 | <varlistentry id="gcov">
|
---|
| 319 | <term><command>gcov</command></term>
|
---|
| 320 | <listitem>
|
---|
| 321 | <para>A coverage testing tool; it is used to analyze programs to
|
---|
| 322 | determine where optimizations will have the most effect</para>
|
---|
| 323 | <indexterm zone="ch-system-gcc gcov">
|
---|
| 324 | <primary sortas="b-gcov">gcov</primary>
|
---|
| 325 | </indexterm>
|
---|
| 326 | </listitem>
|
---|
| 327 | </varlistentry>
|
---|
| 328 |
|
---|
| 329 | <varlistentry id="libgcc">
|
---|
| 330 | <term><filename class="libraryfile">libgcc</filename></term>
|
---|
| 331 | <listitem>
|
---|
| 332 | <para>Contains run-time support for <command>gcc</command></para>
|
---|
| 333 | <indexterm zone="ch-system-gcc libgcc">
|
---|
| 334 | <primary sortas="c-libgcc*">libgcc*</primary>
|
---|
| 335 | </indexterm>
|
---|
| 336 | </listitem>
|
---|
| 337 | </varlistentry>
|
---|
| 338 |
|
---|
[2791a8e] | 339 | <varlistentry id="libmudflap">
|
---|
| 340 | <term><filename class="libraryfile">libmudflap</filename></term>
|
---|
| 341 | <listitem>
|
---|
| 342 | <para>Contains routines that support GCC's bounds checking
|
---|
| 343 | functionality</para>
|
---|
| 344 | <indexterm zone="ch-system-gcc libmudflap">
|
---|
| 345 | <primary sortas="c-libmudflap*">libmudflap*</primary>
|
---|
| 346 | </indexterm>
|
---|
| 347 | </listitem>
|
---|
| 348 | </varlistentry>
|
---|
| 349 |
|
---|
| 350 | <varlistentry id="libssp">
|
---|
| 351 | <term><filename class="libraryfile">libssp</filename></term>
|
---|
| 352 | <listitem>
|
---|
| 353 | <para>Contains routines supporting GCC's stack-smashing protection
|
---|
| 354 | functionality</para>
|
---|
| 355 | <indexterm zone="ch-system-gcc libssp">
|
---|
| 356 | <primary sortas="c-libssp*">libssp*</primary>
|
---|
| 357 | </indexterm>
|
---|
| 358 | </listitem>
|
---|
| 359 | </varlistentry>
|
---|
| 360 |
|
---|
[6a82dd9] | 361 | <varlistentry id="libstdc">
|
---|
| 362 | <term><filename class="libraryfile">libstdc++</filename></term>
|
---|
| 363 | <listitem>
|
---|
| 364 | <para>The standard C++ library</para>
|
---|
| 365 | <indexterm zone="ch-system-gcc libstdc">
|
---|
| 366 | <primary sortas="c-libstdc++">libstdc++</primary>
|
---|
| 367 | </indexterm>
|
---|
| 368 | </listitem>
|
---|
| 369 | </varlistentry>
|
---|
| 370 |
|
---|
| 371 | <varlistentry id="libsupc">
|
---|
| 372 | <term><filename class="libraryfile">libsupc++</filename></term>
|
---|
| 373 | <listitem>
|
---|
| 374 | <para>Provides supporting routines for the C++ programming
|
---|
| 375 | language</para>
|
---|
| 376 | <indexterm zone="ch-system-gcc libsupc">
|
---|
| 377 | <primary sortas="c-libsupc++">libsupc++</primary>
|
---|
| 378 | </indexterm>
|
---|
| 379 | </listitem>
|
---|
| 380 | </varlistentry>
|
---|
| 381 |
|
---|
| 382 | </variablelist>
|
---|
| 383 |
|
---|
| 384 | </sect2>
|
---|
[673b0d8] | 385 |
|
---|
| 386 | </sect1>
|
---|