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