[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 |
|
---|
| 32 | <para>This package is known to behave badly when you have changed its
|
---|
[bb55064] | 33 | default optimization flags (including the <parameter>-march</parameter> and <parameter>-mcpu</parameter> options).
|
---|
[73aedd1d] | 34 | Therefore, if you have defined any environment variables that override
|
---|
[673b0d8] | 35 | default optimizations, such as CFLAGS and CXXFLAGS, we recommend un-setting
|
---|
[73aedd1d] | 36 | or modifying them when building GCC.</para>
|
---|
| 37 |
|
---|
[37dcf2a] | 38 | <para>Unpack the GCC-core <emphasis>and</emphasis> the GCC-g++ tarball -- they
|
---|
[73aedd1d] | 39 | will unfold into the same directory. You should likewise extract the
|
---|
| 40 | GCC-testsuite package. The full GCC package contains even more
|
---|
| 41 | compilers. Instructions for building these can be found at
|
---|
| 42 | <ulink url="&blfs-root;view/stable/general/gcc.html"/>.</para>
|
---|
| 43 |
|
---|
[4248b0e] | 44 | <para>First apply only the No-Fixincludes patch (and <emphasis>not</emphasis>
|
---|
| 45 | the Specs patch) also used in the previous chapter:</para>
|
---|
[37dcf2a] | 46 |
|
---|
[71bbe67] | 47 | <screen><userinput>patch -Np1 -i ../gcc-&gcc-short-version;-no_fixincludes-1.patch</userinput></screen>
|
---|
[37dcf2a] | 48 |
|
---|
| 49 | <para>Now apply a sed substitution that will suppress the installation of
|
---|
[bb55064] | 50 | <filename class="libraryfile">libiberty.a</filename>. We want to use the version of
|
---|
| 51 | <filename class="libraryfile">libiberty.a</filename> provided by Binutils:</para>
|
---|
[37dcf2a] | 52 |
|
---|
| 53 | <screen><userinput>sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
|
---|
[73aedd1d] | 54 |
|
---|
| 55 | <para>The GCC documentation recommends building GCC outside of the source
|
---|
| 56 | directory in a dedicated build directory:</para>
|
---|
| 57 |
|
---|
| 58 | <screen><userinput>mkdir ../gcc-build
|
---|
| 59 | cd ../gcc-build</userinput></screen>
|
---|
| 60 |
|
---|
| 61 | <para>Now prepare GCC for compilation:</para>
|
---|
| 62 |
|
---|
[673b0d8] | 63 | <screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
|
---|
[9dfc02f] | 64 | --libexecdir=/usr/lib --enable-shared --enable-threads=posix \
|
---|
[17fadf7] | 65 | --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++</userinput></screen>
|
---|
[73aedd1d] | 66 |
|
---|
| 67 | <para>Compile the package:</para>
|
---|
| 68 |
|
---|
| 69 | <screen><userinput>make</userinput></screen>
|
---|
| 70 |
|
---|
[90afe40d] | 71 | <important><para>The test suite for GCC in this section is considered
|
---|
| 72 | <emphasis>critical</emphasis>. Our advice is to not skip it under any
|
---|
| 73 | circumstance.</para></important>
|
---|
| 74 |
|
---|
[73aedd1d] | 75 | <para>Test the results, but don't stop at errors (you'll remember the few
|
---|
| 76 | known ones):</para>
|
---|
| 77 |
|
---|
| 78 | <screen><userinput>make -k check</userinput></screen>
|
---|
| 79 |
|
---|
[3be4d97] | 80 | <para>The test suite notes from <xref linkend="ch-tools-gcc-pass2"/> are still very
|
---|
[73aedd1d] | 81 | much appropriate here. Be sure to refer back there should you have any
|
---|
| 82 | doubts.</para>
|
---|
| 83 |
|
---|
[673b0d8] | 84 | <para>Now install the package:</para>
|
---|
[73aedd1d] | 85 |
|
---|
| 86 | <screen><userinput>make install</userinput></screen>
|
---|
| 87 |
|
---|
| 88 | <para>Some packages expect the C PreProcessor to be installed in the
|
---|
[bb55064] | 89 | <filename class="directory">/lib</filename> directory.
|
---|
[673b0d8] | 90 | To support those packages, create this symlink:</para>
|
---|
[73aedd1d] | 91 |
|
---|
| 92 | <screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen>
|
---|
| 93 |
|
---|
[90e3cb3] | 94 | <para>Many packages use the name <command>cc</command> to call the C
|
---|
[73aedd1d] | 95 | compiler. To satisfy those packages, create a symlink:</para>
|
---|
| 96 |
|
---|
| 97 | <screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen>
|
---|
| 98 |
|
---|
| 99 | <note><para>At this point it is strongly recommended to repeat the sanity check
|
---|
| 100 | we performed earlier in this chapter. Refer back to
|
---|
[a0b689e] | 101 | <xref linkend="ch-system-readjusting"/> and repeat the check. If the results
|
---|
[73aedd1d] | 102 | are wrong, then most likely you erroneously applied the GCC Specs patch from
|
---|
[dcff046] | 103 | <xref linkend="chapter-temporary-tools"/>.</para></note>
|
---|
[73aedd1d] | 104 |
|
---|
| 105 | </sect2>
|
---|
[6370fa6] | 106 |
|
---|
[5888299] | 107 |
|
---|
[c6cb3aa] | 108 | <sect2 id="contents-gcc" role="content"><title>Contents of GCC</title>
|
---|
[673b0d8] | 109 |
|
---|
[c6cb3aa] | 110 | <segmentedlist>
|
---|
| 111 | <segtitle>Installed programs</segtitle>
|
---|
| 112 | <segtitle>Installed libraries</segtitle>
|
---|
| 113 | <seglistitem><seg>c++, cc (link to gcc),
|
---|
| 114 | cc1, cc1plus, collect2, cpp, g++, gcc, gccbug, and gcov</seg>
|
---|
| 115 | <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so] and libsupc++.a</seg></seglistitem>
|
---|
| 116 | </segmentedlist>
|
---|
[673b0d8] | 117 |
|
---|
[c6cb3aa] | 118 | <variablelist><title>Short descriptions</title>
|
---|
[673b0d8] | 119 |
|
---|
[b8a819f] | 120 | <varlistentry id="cpp">
|
---|
| 121 | <term><command>cpp</command></term>
|
---|
[c6cb3aa] | 122 | <listitem>
|
---|
[673b0d8] | 123 | <indexterm zone="ch-system-gcc cpp"><primary sortas="b-cpp">cpp</primary></indexterm>
|
---|
[c6cb3aa] | 124 | <para>is the C preprocessor. It is used by the compiler to have the #include and
|
---|
| 125 | #define and such statements expanded in the source files.</para>
|
---|
| 126 | </listitem>
|
---|
| 127 | </varlistentry>
|
---|
| 128 |
|
---|
[b8a819f] | 129 | <varlistentry id="g">
|
---|
| 130 | <term><command>g++</command></term>
|
---|
[c6cb3aa] | 131 | <listitem>
|
---|
[673b0d8] | 132 | <indexterm zone="ch-system-gcc g"><primary sortas="b-g++">g++</primary></indexterm>
|
---|
[c6cb3aa] | 133 | <para>is the C++ compiler.</para>
|
---|
| 134 | </listitem>
|
---|
| 135 | </varlistentry>
|
---|
[673b0d8] | 136 |
|
---|
[b8a819f] | 137 | <varlistentry id="gcc">
|
---|
| 138 | <term><command>gcc</command></term>
|
---|
[c6cb3aa] | 139 | <listitem>
|
---|
[673b0d8] | 140 | <indexterm zone="ch-system-gcc gcc"><primary sortas="b-gcc">gcc</primary></indexterm>
|
---|
[c6cb3aa] | 141 | <para>is the C compiler. It is used to translate
|
---|
[673b0d8] | 142 | the source code of a program into assembly code.</para>
|
---|
[c6cb3aa] | 143 | </listitem>
|
---|
| 144 | </varlistentry>
|
---|
[6370fa6] | 145 |
|
---|
[b8a819f] | 146 | <varlistentry id="gccbug">
|
---|
| 147 | <term><command>gccbug</command></term>
|
---|
[c6cb3aa] | 148 | <listitem>
|
---|
[673b0d8] | 149 | <indexterm zone="ch-system-gcc gccbug"><primary sortas="b-gccbug">gccbug</primary></indexterm>
|
---|
[c6cb3aa] | 150 | <para>is a shell script used to help create good bug reports.</para>
|
---|
| 151 | </listitem>
|
---|
| 152 | </varlistentry>
|
---|
[673b0d8] | 153 |
|
---|
[b8a819f] | 154 | <varlistentry id="gcov">
|
---|
| 155 | <term><command>gcov</command></term>
|
---|
[c6cb3aa] | 156 | <listitem>
|
---|
[673b0d8] | 157 | <indexterm zone="ch-system-gcc gcov"><primary sortas="b-gcov">gcov</primary></indexterm>
|
---|
[c6cb3aa] | 158 | <para>is a coverage testing tool. It is used to
|
---|
[673b0d8] | 159 | analyze programs to find out where optimizations will have the most effect.</para>
|
---|
[c6cb3aa] | 160 | </listitem>
|
---|
| 161 | </varlistentry>
|
---|
[673b0d8] | 162 |
|
---|
[b8a819f] | 163 | <varlistentry id="libgcc">
|
---|
[bb55064] | 164 | <term><filename class="libraryfile">libgcc*</filename></term>
|
---|
[c6cb3aa] | 165 | <listitem>
|
---|
[673b0d8] | 166 | <indexterm zone="ch-system-gcc libgcc"><primary sortas="c-libgcc*">libgcc*</primary></indexterm>
|
---|
[bb55064] | 167 | <para>contains run-time support for <command>gcc</command>.</para>
|
---|
[c6cb3aa] | 168 | </listitem>
|
---|
| 169 | </varlistentry>
|
---|
[673b0d8] | 170 |
|
---|
[b8a819f] | 171 | <varlistentry id="libstdc">
|
---|
[bb55064] | 172 | <term><filename class="libraryfile">libstdc++</filename></term>
|
---|
[c6cb3aa] | 173 | <listitem>
|
---|
[673b0d8] | 174 | <indexterm zone="ch-system-gcc libstdc"><primary sortas="c-libstdc++">libstdc++</primary></indexterm>
|
---|
[c6cb3aa] | 175 | <para>is the standard C++ library. It contains many frequently-used functions.</para>
|
---|
| 176 | </listitem>
|
---|
| 177 | </varlistentry>
|
---|
[673b0d8] | 178 |
|
---|
[b8a819f] | 179 | <varlistentry id="libsupc">
|
---|
[bb55064] | 180 | <term><filename class="libraryfile">libsupc++</filename></term>
|
---|
[c6cb3aa] | 181 | <listitem>
|
---|
[673b0d8] | 182 | <indexterm zone="ch-system-gcc libsupc"><primary sortas="c-libsupc++">libsupc++</primary></indexterm>
|
---|
[c6cb3aa] | 183 | <para>provides supporting routines for the c++ programming language.</para>
|
---|
| 184 | </listitem>
|
---|
| 185 | </varlistentry>
|
---|
| 186 | </variablelist>
|
---|
[673b0d8] | 187 |
|
---|
| 188 | </sect2>
|
---|
| 189 |
|
---|
| 190 | </sect1>
|
---|