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