[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
| 3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
[752f4e5] | 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/>
|
---|
[673b0d8] | 13 | <para>The GCC package contains the GNU compiler collection, which includes
|
---|
[5888299] | 14 | the C and C++ compilers.</para>
|
---|
| 15 |
|
---|
[a001133] | 16 | <segmentedlist>
|
---|
| 17 | <segtitle>&buildtime;</segtitle>
|
---|
| 18 | <segtitle>&diskspace;</segtitle>
|
---|
| 19 | <seglistitem><seg>11.7 SBU</seg><seg>294 MB</seg></seglistitem>
|
---|
| 20 | </segmentedlist>
|
---|
[3554fa3a] | 21 |
|
---|
[a001133] | 22 | <segmentedlist>
|
---|
| 23 | <segtitle>GCC installation depends on</segtitle>
|
---|
| 24 | <seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, Findutils,
|
---|
[69993f4] | 25 | Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, and Texinfo</seg></seglistitem>
|
---|
[a001133] | 26 | </segmentedlist>
|
---|
| 27 | </sect2>
|
---|
[5888299] | 28 |
|
---|
[a001133] | 29 | <sect2 role="installation">
|
---|
[73aedd1d] | 30 | <title>Installation of GCC</title>
|
---|
| 31 |
|
---|
[ef13657] | 32 | <para>This package is known to have issues when its default
|
---|
| 33 | optimization flags (including the <parameter>-march</parameter> and
|
---|
| 34 | <parameter>-mcpu</parameter> options) are changed. If any environment
|
---|
| 35 | variables that override default optimizations have been defined, such
|
---|
[752f4e5] | 36 | as <envar>CFLAGS</envar> and <envar>CXXFLAGS</envar>,
|
---|
[24a08b9] | 37 | unset them when building GCC.</para>
|
---|
[ef13657] | 38 |
|
---|
[69993f4] | 39 | <para>Unpack both the gcc-core and the gcc-g++ tarballs—they will
|
---|
[ef13657] | 40 | unpack into the same directory. Likewise, extract the gcc-testsuite
|
---|
| 41 | package. The full GCC package contains additional compilers.
|
---|
| 42 | Instructions for building these can be found at <ulink
|
---|
[3f6be93] | 43 | url="&blfs-root;view/svn/general/gcc.html"/>.</para>
|
---|
[ef13657] | 44 |
|
---|
| 45 | <para>Apply only the No-Fixincludes patch (not the Specs patch) also
|
---|
| 46 | used in the previous chapter:</para>
|
---|
[37dcf2a] | 47 |
|
---|
[e075967] | 48 | <screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes-1.patch</userinput></screen>
|
---|
[37dcf2a] | 49 |
|
---|
[03084bc9] | 50 | <para>GCC fails to compile some packages outside of a base Linux From Scratch
|
---|
| 51 | install (e.g., Mozilla and kdegraphics) when used in conjunction with newer
|
---|
[7566baf] | 52 | versions of Binutils. Apply the following patch to fix this issue:</para>
|
---|
[03084bc9] | 53 |
|
---|
| 54 | <screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-linkonce-1.patch</userinput></screen>
|
---|
| 55 |
|
---|
[ef13657] | 56 | <para>Apply a sed substitution that will suppress the installation of
|
---|
| 57 | <filename class="libraryfile">libiberty.a</filename>. The version of
|
---|
| 58 | <filename class="libraryfile">libiberty.a</filename> provided by
|
---|
| 59 | Binutils will be used instead:</para>
|
---|
[37dcf2a] | 60 |
|
---|
| 61 | <screen><userinput>sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
|
---|
[73aedd1d] | 62 |
|
---|
[38bb44a] | 63 | <beginpage/>
|
---|
[73aedd1d] | 64 | <para>The GCC documentation recommends building GCC outside of the source
|
---|
| 65 | directory in a dedicated build directory:</para>
|
---|
| 66 |
|
---|
| 67 | <screen><userinput>mkdir ../gcc-build
|
---|
| 68 | cd ../gcc-build</userinput></screen>
|
---|
| 69 |
|
---|
[2256873] | 70 | <para>Prepare GCC for compilation:</para>
|
---|
[73aedd1d] | 71 |
|
---|
[673b0d8] | 72 | <screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
|
---|
[00cc7ce] | 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 |
|
---|
[69993f4] | 81 | <important><para>In this section, the test suite for GCC is considered
|
---|
[ef13657] | 82 | critical. Do not skip it under any circumstance.</para></important>
|
---|
[90afe40d] | 83 |
|
---|
[69993f4] | 84 | <para>Test the results, but do not stop at errors:</para>
|
---|
[73aedd1d] | 85 |
|
---|
| 86 | <screen><userinput>make -k check</userinput></screen>
|
---|
| 87 |
|
---|
[ef13657] | 88 | <para>Some of the errors are known issues and were noted in the
|
---|
| 89 | previous chapter. The test suite notes from <xref
|
---|
[c17fc85] | 90 | linkend="ch-tools-gcc-pass2" role=","/> are still relevant here. Be sure to
|
---|
[ef13657] | 91 | refer back to them as necessary.</para>
|
---|
[73aedd1d] | 92 |
|
---|
[69993f4] | 93 | <para>Install the package:</para>
|
---|
[73aedd1d] | 94 |
|
---|
| 95 | <screen><userinput>make install</userinput></screen>
|
---|
| 96 |
|
---|
| 97 | <para>Some packages expect the C PreProcessor to be installed in the
|
---|
[bb55064] | 98 | <filename class="directory">/lib</filename> directory.
|
---|
[673b0d8] | 99 | To support those packages, create this symlink:</para>
|
---|
[73aedd1d] | 100 |
|
---|
| 101 | <screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen>
|
---|
| 102 |
|
---|
[38bb44a] | 103 | <beginpage/>
|
---|
[90e3cb3] | 104 | <para>Many packages use the name <command>cc</command> to call the C
|
---|
[73aedd1d] | 105 | compiler. To satisfy those packages, create a symlink:</para>
|
---|
| 106 |
|
---|
| 107 | <screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen>
|
---|
| 108 |
|
---|
[69993f4] | 109 | <note><para>At this point, it is strongly recommended to repeat the
|
---|
| 110 | sanity check performed earlier in this chapter. Refer back to <xref
|
---|
[c17fc85] | 111 | linkend="ch-system-readjusting" role=","/> and repeat the check. If the results
|
---|
[ef13657] | 112 | are in error, then the most likely reason is that the GCC Specs patch
|
---|
| 113 | from <xref linkend="chapter-temporary-tools"/> was erroneously applied
|
---|
| 114 | here.</para></note>
|
---|
[73aedd1d] | 115 |
|
---|
| 116 | </sect2>
|
---|
[6370fa6] | 117 |
|
---|
[5888299] | 118 |
|
---|
[c6cb3aa] | 119 | <sect2 id="contents-gcc" role="content"><title>Contents of GCC</title>
|
---|
[673b0d8] | 120 |
|
---|
[c6cb3aa] | 121 | <segmentedlist>
|
---|
| 122 | <segtitle>Installed programs</segtitle>
|
---|
| 123 | <segtitle>Installed libraries</segtitle>
|
---|
[dadb405] | 124 | <seglistitem><seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and
|
---|
| 125 | gcov</seg>
|
---|
[69993f4] | 126 | <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so], and libsupc++.a</seg></seglistitem>
|
---|
[c6cb3aa] | 127 | </segmentedlist>
|
---|
[673b0d8] | 128 |
|
---|
[2256873] | 129 | <variablelist><bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
[3ed279f] | 130 | <?dbfo list-presentation="list"?>
|
---|
[673b0d8] | 131 |
|
---|
[2256873] | 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 |
|
---|
[b8a819f] | 140 | <varlistentry id="cpp">
|
---|
| 141 | <term><command>cpp</command></term>
|
---|
[c6cb3aa] | 142 | <listitem>
|
---|
[2256873] | 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>
|
---|
[3ed279f] | 145 | <indexterm zone="ch-system-gcc cpp"><primary sortas="b-cpp">cpp</primary></indexterm>
|
---|
[c6cb3aa] | 146 | </listitem>
|
---|
| 147 | </varlistentry>
|
---|
| 148 |
|
---|
[2256873] | 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 |
|
---|
[b8a819f] | 157 | <varlistentry id="g">
|
---|
| 158 | <term><command>g++</command></term>
|
---|
[c6cb3aa] | 159 | <listitem>
|
---|
[2256873] | 160 | <para>The C++ compiler</para>
|
---|
[3ed279f] | 161 | <indexterm zone="ch-system-gcc g"><primary sortas="b-g++">g++</primary></indexterm>
|
---|
[c6cb3aa] | 162 | </listitem>
|
---|
| 163 | </varlistentry>
|
---|
[673b0d8] | 164 |
|
---|
[b8a819f] | 165 | <varlistentry id="gcc">
|
---|
| 166 | <term><command>gcc</command></term>
|
---|
[c6cb3aa] | 167 | <listitem>
|
---|
[2256873] | 168 | <para>The C compiler</para>
|
---|
[3ed279f] | 169 | <indexterm zone="ch-system-gcc gcc"><primary sortas="b-gcc">gcc</primary></indexterm>
|
---|
[c6cb3aa] | 170 | </listitem>
|
---|
| 171 | </varlistentry>
|
---|
[6370fa6] | 172 |
|
---|
[b8a819f] | 173 | <varlistentry id="gccbug">
|
---|
| 174 | <term><command>gccbug</command></term>
|
---|
[c6cb3aa] | 175 | <listitem>
|
---|
[2256873] | 176 | <para>A shell script used to help create useful bug reports</para>
|
---|
[3ed279f] | 177 | <indexterm zone="ch-system-gcc gccbug"><primary sortas="b-gccbug">gccbug</primary></indexterm>
|
---|
[c6cb3aa] | 178 | </listitem>
|
---|
| 179 | </varlistentry>
|
---|
[673b0d8] | 180 |
|
---|
[b8a819f] | 181 | <varlistentry id="gcov">
|
---|
| 182 | <term><command>gcov</command></term>
|
---|
[c6cb3aa] | 183 | <listitem>
|
---|
[2256873] | 184 | <para>A coverage testing tool; it is used to analyze programs to
|
---|
| 185 | determine where optimizations will have the most effect</para>
|
---|
[3ed279f] | 186 | <indexterm zone="ch-system-gcc gcov"><primary sortas="b-gcov">gcov</primary></indexterm>
|
---|
[c6cb3aa] | 187 | </listitem>
|
---|
| 188 | </varlistentry>
|
---|
[673b0d8] | 189 |
|
---|
[b8a819f] | 190 | <varlistentry id="libgcc">
|
---|
[2256873] | 191 | <term><filename class="libraryfile">libgcc</filename></term>
|
---|
[c6cb3aa] | 192 | <listitem>
|
---|
[2256873] | 193 | <para>Contains run-time support for <command>gcc</command></para>
|
---|
[3ed279f] | 194 | <indexterm zone="ch-system-gcc libgcc"><primary sortas="c-libgcc*">libgcc*</primary></indexterm>
|
---|
[c6cb3aa] | 195 | </listitem>
|
---|
| 196 | </varlistentry>
|
---|
[673b0d8] | 197 |
|
---|
[b8a819f] | 198 | <varlistentry id="libstdc">
|
---|
[bb55064] | 199 | <term><filename class="libraryfile">libstdc++</filename></term>
|
---|
[c6cb3aa] | 200 | <listitem>
|
---|
[2256873] | 201 | <para>The standard C++ library</para>
|
---|
[3ed279f] | 202 | <indexterm zone="ch-system-gcc libstdc"><primary sortas="c-libstdc++">libstdc++</primary></indexterm>
|
---|
[c6cb3aa] | 203 | </listitem>
|
---|
| 204 | </varlistentry>
|
---|
[673b0d8] | 205 |
|
---|
[b8a819f] | 206 | <varlistentry id="libsupc">
|
---|
[bb55064] | 207 | <term><filename class="libraryfile">libsupc++</filename></term>
|
---|
[c6cb3aa] | 208 | <listitem>
|
---|
[2256873] | 209 | <para>Provides supporting routines for the C++ programming language</para>
|
---|
[3ed279f] | 210 | <indexterm zone="ch-system-gcc libsupc"><primary sortas="c-libsupc++">libsupc++</primary></indexterm>
|
---|
[c6cb3aa] | 211 | </listitem>
|
---|
| 212 | </varlistentry>
|
---|
| 213 | </variablelist>
|
---|
[673b0d8] | 214 |
|
---|
| 215 | </sect2>
|
---|
| 216 |
|
---|
| 217 | </sect1>
|
---|
[ef13657] | 218 |
|
---|