[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 | ]>
|
---|
[a001133] | 6 | <sect1 id="ch-system-gcc" xreflabel="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,
|
---|
| 25 | Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, Texinfo</seg></seglistitem>
|
---|
| 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
|
---|
| 36 | as <emphasis>CFLAGS</emphasis> and <emphasis>CXXFLAGS</emphasis>,
|
---|
| 37 | unset or modifying them when building Binutils.</para>
|
---|
| 38 |
|
---|
| 39 | <para>Unpack both the gcc-core and the gcc-g++ tarballs -- they will
|
---|
| 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
|
---|
| 43 | url="&blfs-root;view/stable/general/gcc.html"/>.</para>
|
---|
| 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 |
|
---|
[ef13657] | 50 | <para>Apply a sed substitution that will suppress the installation of
|
---|
| 51 | <filename class="libraryfile">libiberty.a</filename>. The version of
|
---|
| 52 | <filename class="libraryfile">libiberty.a</filename> provided by
|
---|
| 53 | Binutils will be used instead:</para>
|
---|
[37dcf2a] | 54 |
|
---|
| 55 | <screen><userinput>sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
|
---|
[73aedd1d] | 56 |
|
---|
| 57 | <para>The GCC documentation recommends building GCC outside of the source
|
---|
| 58 | directory in a dedicated build directory:</para>
|
---|
| 59 |
|
---|
| 60 | <screen><userinput>mkdir ../gcc-build
|
---|
| 61 | cd ../gcc-build</userinput></screen>
|
---|
| 62 |
|
---|
| 63 | <para>Now prepare GCC for compilation:</para>
|
---|
| 64 |
|
---|
[673b0d8] | 65 | <screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
|
---|
[9dfc02f] | 66 | --libexecdir=/usr/lib --enable-shared --enable-threads=posix \
|
---|
[17fadf7] | 67 | --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++</userinput></screen>
|
---|
[73aedd1d] | 68 |
|
---|
| 69 | <para>Compile the package:</para>
|
---|
| 70 |
|
---|
| 71 | <screen><userinput>make</userinput></screen>
|
---|
| 72 |
|
---|
[90afe40d] | 73 | <important><para>The test suite for GCC in this section is considered
|
---|
[ef13657] | 74 | critical. Do not skip it under any circumstance.</para></important>
|
---|
[90afe40d] | 75 |
|
---|
[ef13657] | 76 | <para>Test the results, but don't stop at errors:</para>
|
---|
[73aedd1d] | 77 |
|
---|
| 78 | <screen><userinput>make -k check</userinput></screen>
|
---|
| 79 |
|
---|
[ef13657] | 80 | <para>Some of the errors are known issues and were noted in the
|
---|
| 81 | previous chapter. The test suite notes from <xref
|
---|
| 82 | linkend="ch-tools-gcc-pass2"/> are still relevant here. Be sure to
|
---|
| 83 | refer back to them as necessary.</para>
|
---|
[73aedd1d] | 84 |
|
---|
[ef13657] | 85 | <para>Iinstall the package:</para>
|
---|
[73aedd1d] | 86 |
|
---|
| 87 | <screen><userinput>make install</userinput></screen>
|
---|
| 88 |
|
---|
| 89 | <para>Some packages expect the C PreProcessor to be installed in the
|
---|
[bb55064] | 90 | <filename class="directory">/lib</filename> directory.
|
---|
[673b0d8] | 91 | To support those packages, create this symlink:</para>
|
---|
[73aedd1d] | 92 |
|
---|
| 93 | <screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen>
|
---|
| 94 |
|
---|
[90e3cb3] | 95 | <para>Many packages use the name <command>cc</command> to call the C
|
---|
[73aedd1d] | 96 | compiler. To satisfy those packages, create a symlink:</para>
|
---|
| 97 |
|
---|
| 98 | <screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen>
|
---|
| 99 |
|
---|
[ef13657] | 100 | <note><para>At this point it is strongly recommended to repeat the
|
---|
| 101 | sanity check we performed earlier in this chapter. Refer back to <xref
|
---|
| 102 | linkend="ch-system-readjusting"/> and repeat the check. If the results
|
---|
| 103 | are in error, then the most likely reason is that the GCC Specs patch
|
---|
| 104 | from <xref linkend="chapter-temporary-tools"/> was erroneously applied
|
---|
| 105 | here.</para></note>
|
---|
[73aedd1d] | 106 |
|
---|
| 107 | </sect2>
|
---|
[6370fa6] | 108 |
|
---|
[5888299] | 109 |
|
---|
[c6cb3aa] | 110 | <sect2 id="contents-gcc" role="content"><title>Contents of GCC</title>
|
---|
[673b0d8] | 111 |
|
---|
[c6cb3aa] | 112 | <segmentedlist>
|
---|
| 113 | <segtitle>Installed programs</segtitle>
|
---|
| 114 | <segtitle>Installed libraries</segtitle>
|
---|
| 115 | <seglistitem><seg>c++, cc (link to gcc),
|
---|
| 116 | cc1, cc1plus, collect2, cpp, g++, gcc, gccbug, and gcov</seg>
|
---|
| 117 | <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so] and libsupc++.a</seg></seglistitem>
|
---|
| 118 | </segmentedlist>
|
---|
[673b0d8] | 119 |
|
---|
[3ed279f] | 120 | <variablelist><bridgehead renderas="sect3">Short descriptions</bridgehead>
|
---|
| 121 | <?dbfo list-presentation="list"?>
|
---|
[673b0d8] | 122 |
|
---|
[b8a819f] | 123 | <varlistentry id="cpp">
|
---|
| 124 | <term><command>cpp</command></term>
|
---|
[c6cb3aa] | 125 | <listitem>
|
---|
[ef13657] | 126 | <para>the C preprocessor. It is used by the compiler expand the
|
---|
| 127 | #include, #define, and similar statements in the source files.</para>
|
---|
[3ed279f] | 128 | <indexterm zone="ch-system-gcc cpp"><primary sortas="b-cpp">cpp</primary></indexterm>
|
---|
[c6cb3aa] | 129 | </listitem>
|
---|
| 130 | </varlistentry>
|
---|
| 131 |
|
---|
[b8a819f] | 132 | <varlistentry id="g">
|
---|
| 133 | <term><command>g++</command></term>
|
---|
[c6cb3aa] | 134 | <listitem>
|
---|
[ef13657] | 135 | <para>the C++ compiler.</para>
|
---|
[3ed279f] | 136 | <indexterm zone="ch-system-gcc g"><primary sortas="b-g++">g++</primary></indexterm>
|
---|
[c6cb3aa] | 137 | </listitem>
|
---|
| 138 | </varlistentry>
|
---|
[673b0d8] | 139 |
|
---|
[b8a819f] | 140 | <varlistentry id="gcc">
|
---|
| 141 | <term><command>gcc</command></term>
|
---|
[c6cb3aa] | 142 | <listitem>
|
---|
[ef13657] | 143 | <para>the C compiler.</para>
|
---|
[3ed279f] | 144 | <indexterm zone="ch-system-gcc gcc"><primary sortas="b-gcc">gcc</primary></indexterm>
|
---|
[c6cb3aa] | 145 | </listitem>
|
---|
| 146 | </varlistentry>
|
---|
[6370fa6] | 147 |
|
---|
[b8a819f] | 148 | <varlistentry id="gccbug">
|
---|
| 149 | <term><command>gccbug</command></term>
|
---|
[c6cb3aa] | 150 | <listitem>
|
---|
[ef13657] | 151 | <para>a shell script used to help create useful bug reports.</para>
|
---|
[3ed279f] | 152 | <indexterm zone="ch-system-gcc gccbug"><primary sortas="b-gccbug">gccbug</primary></indexterm>
|
---|
[c6cb3aa] | 153 | </listitem>
|
---|
| 154 | </varlistentry>
|
---|
[673b0d8] | 155 |
|
---|
[b8a819f] | 156 | <varlistentry id="gcov">
|
---|
| 157 | <term><command>gcov</command></term>
|
---|
[c6cb3aa] | 158 | <listitem>
|
---|
[ef13657] | 159 | <para>a coverage testing tool. It is used to analyze programs to
|
---|
| 160 | determine where optimizations will have the most effect.</para>
|
---|
[3ed279f] | 161 | <indexterm zone="ch-system-gcc gcov"><primary sortas="b-gcov">gcov</primary></indexterm>
|
---|
[c6cb3aa] | 162 | </listitem>
|
---|
| 163 | </varlistentry>
|
---|
[673b0d8] | 164 |
|
---|
[b8a819f] | 165 | <varlistentry id="libgcc">
|
---|
[bb55064] | 166 | <term><filename class="libraryfile">libgcc*</filename></term>
|
---|
[c6cb3aa] | 167 | <listitem>
|
---|
[bb55064] | 168 | <para>contains run-time support for <command>gcc</command>.</para>
|
---|
[3ed279f] | 169 | <indexterm zone="ch-system-gcc libgcc"><primary sortas="c-libgcc*">libgcc*</primary></indexterm>
|
---|
[c6cb3aa] | 170 | </listitem>
|
---|
| 171 | </varlistentry>
|
---|
[673b0d8] | 172 |
|
---|
[b8a819f] | 173 | <varlistentry id="libstdc">
|
---|
[bb55064] | 174 | <term><filename class="libraryfile">libstdc++</filename></term>
|
---|
[c6cb3aa] | 175 | <listitem>
|
---|
[ef13657] | 176 | <para>the standard C++ library.</para>
|
---|
[3ed279f] | 177 | <indexterm zone="ch-system-gcc libstdc"><primary sortas="c-libstdc++">libstdc++</primary></indexterm>
|
---|
[c6cb3aa] | 178 | </listitem>
|
---|
| 179 | </varlistentry>
|
---|
[673b0d8] | 180 |
|
---|
[b8a819f] | 181 | <varlistentry id="libsupc">
|
---|
[bb55064] | 182 | <term><filename class="libraryfile">libsupc++</filename></term>
|
---|
[c6cb3aa] | 183 | <listitem>
|
---|
| 184 | <para>provides supporting routines for the c++ programming language.</para>
|
---|
[3ed279f] | 185 | <indexterm zone="ch-system-gcc libsupc"><primary sortas="c-libsupc++">libsupc++</primary></indexterm>
|
---|
[c6cb3aa] | 186 | </listitem>
|
---|
| 187 | </varlistentry>
|
---|
| 188 | </variablelist>
|
---|
[673b0d8] | 189 |
|
---|
| 190 | </sect2>
|
---|
| 191 |
|
---|
| 192 | </sect1>
|
---|
[ef13657] | 193 |
|
---|