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