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