[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 |
|
---|
| 41 | <para>Apply only the No-Fixincludes patch (not the Specs patch) also
|
---|
| 42 | used in the previous chapter:</para>
|
---|
[37dcf2a] | 43 |
|
---|
[3e36a78] | 44 | <screen><userinput>patch -Np1 -i ../&gcc-no_fixincludes-patch;</userinput></screen>
|
---|
[041cbb60] | 45 |
|
---|
[81fd230] | 46 | <para>GCC fails to compile some packages outside of a base Linux From Scratch
|
---|
| 47 | install (e.g., Mozilla and kdegraphics) when used in conjunction with newer
|
---|
| 48 | versions of Binutils. Apply the following patch to fix this issue:</para>
|
---|
[041cbb60] | 49 |
|
---|
[3e36a78] | 50 | <screen><userinput>patch -Np1 -i ../&gcc-linkonce-patch;</userinput></screen>
|
---|
[37dcf2a] | 51 |
|
---|
[bc2136e] | 52 | <para>Apply a <command>sed</command> substitution that will suppress the
|
---|
| 53 | installation of <filename class="libraryfile">libiberty.a</filename>. The
|
---|
| 54 | version of <filename class="libraryfile">libiberty.a</filename> provided by
|
---|
[81fd230] | 55 | Binutils will be used instead:</para>
|
---|
[37dcf2a] | 56 |
|
---|
| 57 | <screen><userinput>sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
|
---|
[73aedd1d] | 58 |
|
---|
[81fd230] | 59 | <para>The GCC documentation recommends building GCC outside of the source
|
---|
| 60 | directory in a dedicated build directory:</para>
|
---|
[73aedd1d] | 61 |
|
---|
| 62 | <screen><userinput>mkdir ../gcc-build
|
---|
| 63 | cd ../gcc-build</userinput></screen>
|
---|
| 64 |
|
---|
[81fd230] | 65 | <para>Prepare GCC for compilation:</para>
|
---|
[73aedd1d] | 66 |
|
---|
[673b0d8] | 67 | <screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
|
---|
[d72e04a] | 68 | --libexecdir=/usr/lib --enable-shared \
|
---|
| 69 | --enable-threads=posix --enable-__cxa_atexit \
|
---|
| 70 | --enable-clocale=gnu --enable-languages=c,c++</userinput></screen>
|
---|
[73aedd1d] | 71 |
|
---|
| 72 | <para>Compile the package:</para>
|
---|
| 73 |
|
---|
| 74 | <screen><userinput>make</userinput></screen>
|
---|
| 75 |
|
---|
[81fd230] | 76 | <important><para>In this section, the test suite for GCC is considered
|
---|
| 77 | critical. Do not skip it under any circumstance.</para></important>
|
---|
| 78 |
|
---|
| 79 | <para>Test the results, but do not stop at errors:</para>
|
---|
[73aedd1d] | 80 |
|
---|
| 81 | <screen><userinput>make -k check</userinput></screen>
|
---|
| 82 |
|
---|
[81fd230] | 83 | <para>Some of the errors are known issues and were noted in the
|
---|
| 84 | previous chapter. The test suite notes from <xref
|
---|
| 85 | linkend="ch-tools-gcc-pass2" role=","/> are still relevant here. Be sure to
|
---|
| 86 | refer back to them as necessary.</para>
|
---|
[73aedd1d] | 87 |
|
---|
[81fd230] | 88 | <para>Install the package:</para>
|
---|
[73aedd1d] | 89 |
|
---|
| 90 | <screen><userinput>make install</userinput></screen>
|
---|
| 91 |
|
---|
[bc2136e] | 92 | <para>Some packages expect the C preprocessor to be installed in the
|
---|
[81fd230] | 93 | <filename class="directory">/lib</filename> directory.
|
---|
| 94 | To support those packages, create this symlink:</para>
|
---|
[73aedd1d] | 95 |
|
---|
| 96 | <screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen>
|
---|
| 97 |
|
---|
[81fd230] | 98 | <para>Many packages use the name <command>cc</command> to call the C
|
---|
| 99 | compiler. To satisfy those packages, create a symlink:</para>
|
---|
[73aedd1d] | 100 |
|
---|
| 101 | <screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen>
|
---|
| 102 |
|
---|
[81fd230] | 103 | <note><para>At this point, it is strongly recommended to repeat the
|
---|
| 104 | sanity check performed earlier in this chapter. Refer back to <xref
|
---|
| 105 | linkend="ch-system-readjusting" role=","/> and repeat the check. If the results
|
---|
| 106 | are in error, then the most likely reason is that the GCC Specs patch
|
---|
| 107 | from <xref linkend="chapter-temporary-tools"/> was erroneously applied
|
---|
| 108 | here.</para></note>
|
---|
[73aedd1d] | 109 |
|
---|
| 110 | </sect2>
|
---|
[6370fa6] | 111 |
|
---|
[5888299] | 112 |
|
---|
[c6cb3aa] | 113 | <sect2 id="contents-gcc" role="content"><title>Contents of GCC</title>
|
---|
[673b0d8] | 114 |
|
---|
[81fd230] | 115 | <segmentedlist>
|
---|
| 116 | <segtitle>Installed programs</segtitle>
|
---|
| 117 | <segtitle>Installed libraries</segtitle>
|
---|
| 118 | <seglistitem><seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and
|
---|
| 119 | gcov</seg>
|
---|
| 120 | <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so], and libsupc++.a</seg></seglistitem>
|
---|
| 121 | </segmentedlist>
|
---|
| 122 |
|
---|
| 123 | <variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 124 | <?dbfo list-presentation="list"?>
|
---|
[8f97096] | 125 | <?dbhtml list-presentation="table"?>
|
---|
[81fd230] | 126 |
|
---|
| 127 | <varlistentry id="cc">
|
---|
| 128 | <term><command>cc</command></term>
|
---|
| 129 | <listitem>
|
---|
| 130 | <para>The C compiler</para>
|
---|
| 131 | <indexterm zone="ch-system-gcc cc"><primary sortas="b-cc">cc</primary></indexterm>
|
---|
| 132 | </listitem>
|
---|
| 133 | </varlistentry>
|
---|
| 134 |
|
---|
| 135 | <varlistentry id="cpp">
|
---|
| 136 | <term><command>cpp</command></term>
|
---|
| 137 | <listitem>
|
---|
| 138 | <para>The C preprocessor; it is used by the compiler to expand the
|
---|
| 139 | #include, #define, and similar statements in the source files</para>
|
---|
| 140 | <indexterm zone="ch-system-gcc cpp"><primary sortas="b-cpp">cpp</primary></indexterm>
|
---|
| 141 | </listitem>
|
---|
| 142 | </varlistentry>
|
---|
| 143 |
|
---|
| 144 | <varlistentry id="c">
|
---|
| 145 | <term><command>c++</command></term>
|
---|
| 146 | <listitem>
|
---|
| 147 | <para>The C++ compiler</para>
|
---|
| 148 | <indexterm zone="ch-system-gcc c"><primary sortas="b-c++">c++</primary></indexterm>
|
---|
| 149 | </listitem>
|
---|
| 150 | </varlistentry>
|
---|
| 151 |
|
---|
| 152 | <varlistentry id="g">
|
---|
| 153 | <term><command>g++</command></term>
|
---|
| 154 | <listitem>
|
---|
| 155 | <para>The C++ compiler</para>
|
---|
| 156 | <indexterm zone="ch-system-gcc g"><primary sortas="b-g++">g++</primary></indexterm>
|
---|
| 157 | </listitem>
|
---|
| 158 | </varlistentry>
|
---|
| 159 |
|
---|
| 160 | <varlistentry id="gcc">
|
---|
| 161 | <term><command>gcc</command></term>
|
---|
| 162 | <listitem>
|
---|
| 163 | <para>The C compiler</para>
|
---|
| 164 | <indexterm zone="ch-system-gcc gcc"><primary sortas="b-gcc">gcc</primary></indexterm>
|
---|
| 165 | </listitem>
|
---|
| 166 | </varlistentry>
|
---|
| 167 |
|
---|
| 168 | <varlistentry id="gccbug">
|
---|
| 169 | <term><command>gccbug</command></term>
|
---|
| 170 | <listitem>
|
---|
| 171 | <para>A shell script used to help create useful bug reports</para>
|
---|
| 172 | <indexterm zone="ch-system-gcc gccbug"><primary sortas="b-gccbug">gccbug</primary></indexterm>
|
---|
| 173 | </listitem>
|
---|
| 174 | </varlistentry>
|
---|
| 175 |
|
---|
| 176 | <varlistentry id="gcov">
|
---|
| 177 | <term><command>gcov</command></term>
|
---|
| 178 | <listitem>
|
---|
| 179 | <para>A coverage testing tool; it is used to analyze programs to
|
---|
| 180 | determine where optimizations will have the most effect</para>
|
---|
| 181 | <indexterm zone="ch-system-gcc gcov"><primary sortas="b-gcov">gcov</primary></indexterm>
|
---|
| 182 | </listitem>
|
---|
| 183 | </varlistentry>
|
---|
| 184 |
|
---|
| 185 | <varlistentry id="libgcc">
|
---|
| 186 | <term><filename class="libraryfile">libgcc</filename></term>
|
---|
| 187 | <listitem>
|
---|
| 188 | <para>Contains run-time support for <command>gcc</command></para>
|
---|
| 189 | <indexterm zone="ch-system-gcc libgcc"><primary sortas="c-libgcc*">libgcc*</primary></indexterm>
|
---|
| 190 | </listitem>
|
---|
| 191 | </varlistentry>
|
---|
| 192 |
|
---|
| 193 | <varlistentry id="libstdc">
|
---|
| 194 | <term><filename class="libraryfile">libstdc++</filename></term>
|
---|
| 195 | <listitem>
|
---|
| 196 | <para>The standard C++ library</para>
|
---|
| 197 | <indexterm zone="ch-system-gcc libstdc"><primary sortas="c-libstdc++">libstdc++</primary></indexterm>
|
---|
| 198 | </listitem>
|
---|
| 199 | </varlistentry>
|
---|
| 200 |
|
---|
| 201 | <varlistentry id="libsupc">
|
---|
| 202 | <term><filename class="libraryfile">libsupc++</filename></term>
|
---|
| 203 | <listitem>
|
---|
| 204 | <para>Provides supporting routines for the C++ programming language</para>
|
---|
| 205 | <indexterm zone="ch-system-gcc libsupc"><primary sortas="c-libsupc++">libsupc++</primary></indexterm>
|
---|
| 206 | </listitem>
|
---|
| 207 | </varlistentry>
|
---|
| 208 | </variablelist>
|
---|
[673b0d8] | 209 |
|
---|
| 210 | </sect2>
|
---|
| 211 |
|
---|
| 212 | </sect1>
|
---|
[81fd230] | 213 |
|
---|