[02095ae] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[c439b8a] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[02095ae] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
| 8 | <sect1 id="ch-system-gcc" role="wrap">
|
---|
| 9 | <?dbhtml filename="gcc.html"?>
|
---|
| 10 |
|
---|
| 11 | <title>GCC-&gcc-version;</title>
|
---|
| 12 |
|
---|
| 13 | <indexterm zone="ch-system-gcc">
|
---|
| 14 | <primary sortas="a-GCC">GCC</primary>
|
---|
| 15 | </indexterm>
|
---|
| 16 |
|
---|
| 17 | <sect2 role="package">
|
---|
| 18 | <title/>
|
---|
| 19 |
|
---|
| 20 | <para>The GCC package contains the GNU compiler collection, which includes
|
---|
| 21 | the C and C++ compilers.</para>
|
---|
| 22 |
|
---|
| 23 | </sect2>
|
---|
| 24 |
|
---|
| 25 | <sect2 role="installation">
|
---|
| 26 | <title>Installation of GCC</title>
|
---|
| 27 |
|
---|
[7126617] | 28 | <para os="p1">To make sure that a couple of tools use the proper syntax,
|
---|
| 29 | apply the following patch:</para>
|
---|
| 30 |
|
---|
[5ec080e] | 31 | <screen os="p2"><userinput>patch -Np1 -i ../&gcc-posix-patch;</userinput></screen>
|
---|
[7126617] | 32 |
|
---|
[830dc4e] | 33 | <para os="p3">The following patch fixes the searching of multilib dirs
|
---|
| 34 | for specs file. The patch standardizes the gcc drivers path iteration
|
---|
| 35 | functions, ensuring multilib directories are searched in the correct
|
---|
| 36 | order. This fixes various issues, most noticably with libtool on
|
---|
| 37 | multilib systems:</para>
|
---|
| 38 |
|
---|
| 39 | <screen os="p4"><userinput>patch -Np1 -i ../&gcc-PR20425-patch;</userinput></screen>
|
---|
| 40 |
|
---|
[02095ae] | 41 | <para os="a">Apply a <command>sed</command> substitution that will suppress the
|
---|
| 42 | installation of <filename class="libraryfile">libiberty.a</filename>. The
|
---|
| 43 | version of <filename class="libraryfile">libiberty.a</filename> provided by
|
---|
| 44 | Binutils will be used instead:</para>
|
---|
| 45 |
|
---|
[7126617] | 46 | <screen os="b"><userinput>cp libiberty/Makefile.in{,.orig}
|
---|
| 47 | sed 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in.orig > libiberty/Makefile.in</userinput></screen>
|
---|
[02095ae] | 48 |
|
---|
| 49 | <para os="e1">GCC provides a <command>gccbug</command> script which detects at
|
---|
| 50 | compile time whether mktemp is present, and hardcodes the result in a test.
|
---|
| 51 | If mktemp is not found, the script will fall back to using less
|
---|
| 52 | random names for temporary files. We will be installing mktemp
|
---|
| 53 | later, so the following sed will simulate its presence:</para>
|
---|
| 54 |
|
---|
[7126617] | 55 | <screen os="e2"><userinput>cp gcc/gccbug.in{,.orig}
|
---|
| 56 | sed 's/@have_mktemp_command@/yes/' gcc/gccbug.in.orig > gcc/gccbug.in</userinput></screen>
|
---|
[02095ae] | 57 |
|
---|
[c0cd0ca] | 58 | <para os="s1">The fixincludes attempts to "fix" the system headers
|
---|
| 59 | installed so far. Since gcc is cross-compiled expecting the system
|
---|
| 60 | headers to be in <filename class="directory">/usr/include</filename>
|
---|
| 61 | the script will be looking at host headers. The following sed prevents
|
---|
| 62 | the fixincludes script from running:</para>
|
---|
| 63 |
|
---|
| 64 | <screen os="s2"><userinput>cp gcc/Makefile.in{,.orig}
|
---|
| 65 | sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in</userinput></screen>
|
---|
| 66 |
|
---|
[02095ae] | 67 | <para os="c">The GCC documentation recommends building GCC outside of the source
|
---|
| 68 | directory in a dedicated build directory:</para>
|
---|
| 69 |
|
---|
| 70 | <screen os="d"><userinput>mkdir -v ../gcc-build
|
---|
| 71 | cd ../gcc-build</userinput></screen>
|
---|
| 72 |
|
---|
| 73 | <para os="e">Prepare GCC for compilation:</para>
|
---|
| 74 |
|
---|
[7126617] | 75 | <screen os="f"><userinput>../gcc-&gcc-version;/configure --prefix=/usr --libexecdir=/usr/lib \
|
---|
[586feb7] | 76 | --build=${CLFS_HOST} --host=${CLFS_TARGET} --target=${CLFS_TARGET} \
|
---|
[02095ae] | 77 | --enable-shared --enable-threads=posix --enable-__cxa_atexit \
|
---|
| 78 | --enable-c99 --enable-long-long --enable-clocale=gnu \
|
---|
| 79 | --enable-languages=c,c++ --disable-libstdcxx-pch</userinput></screen>
|
---|
| 80 |
|
---|
| 81 | <para os="g">Compile the package:</para>
|
---|
| 82 |
|
---|
| 83 | <screen os="h"><userinput>make</userinput></screen>
|
---|
| 84 |
|
---|
| 85 | <para os="i">Install the package:</para>
|
---|
| 86 |
|
---|
[586feb7] | 87 | <screen os="j"><userinput>make DESTDIR=${CLFS} install</userinput></screen>
|
---|
[02095ae] | 88 |
|
---|
| 89 | <para os="k">Some packages expect the C preprocessor to be installed in the
|
---|
| 90 | <filename class="directory">/lib</filename> directory.
|
---|
| 91 | To support those packages, create this symlink:</para>
|
---|
| 92 |
|
---|
[7e336f1] | 93 | <screen os="l"><userinput>ln -sfv ../usr/bin/cpp ${CLFS}/lib</userinput></screen>
|
---|
[02095ae] | 94 |
|
---|
| 95 | <para os="m">Many packages use the name <command>cc</command> to call the C
|
---|
| 96 | compiler. To satisfy those packages, create a symlink:</para>
|
---|
| 97 |
|
---|
[7e336f1] | 98 | <screen os="o"><userinput>ln -sfv gcc ${CLFS}/usr/bin/cc</userinput></screen>
|
---|
[02095ae] | 99 |
|
---|
| 100 | </sect2>
|
---|
| 101 |
|
---|
| 102 | <sect2 id="contents-gcc" role="content">
|
---|
| 103 | <title>Contents of GCC</title>
|
---|
| 104 |
|
---|
| 105 | <segmentedlist>
|
---|
| 106 | <segtitle>Installed programs</segtitle>
|
---|
| 107 | <segtitle>Installed libraries</segtitle>
|
---|
| 108 |
|
---|
| 109 | <seglistitem>
|
---|
| 110 | <seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcov</seg>
|
---|
| 111 | <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libmudflap.[a,so],
|
---|
| 112 | libmudflapth.[a,so], libstdc++.[a,so], and
|
---|
| 113 | libsupc++.a</seg>
|
---|
| 114 | </seglistitem>
|
---|
| 115 | </segmentedlist>
|
---|
| 116 |
|
---|
| 117 | <variablelist>
|
---|
| 118 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 119 | <?dbfo list-presentation="list"?>
|
---|
| 120 | <?dbhtml list-presentation="table"?>
|
---|
| 121 |
|
---|
| 122 | <varlistentry id="cc">
|
---|
| 123 | <term><command>cc</command></term>
|
---|
| 124 | <listitem>
|
---|
| 125 | <para>The C compiler</para>
|
---|
| 126 | <indexterm zone="ch-system-gcc cc">
|
---|
| 127 | <primary sortas="b-cc">cc</primary>
|
---|
| 128 | </indexterm>
|
---|
| 129 | </listitem>
|
---|
| 130 | </varlistentry>
|
---|
| 131 |
|
---|
| 132 | <varlistentry id="cpp">
|
---|
| 133 | <term><command>cpp</command></term>
|
---|
| 134 | <listitem>
|
---|
| 135 | <para>The C preprocessor; it is used by the compiler to expand the
|
---|
| 136 | #include, #define, and similar statements in the source files</para>
|
---|
| 137 | <indexterm zone="ch-system-gcc cpp">
|
---|
| 138 | <primary sortas="b-cpp">cpp</primary>
|
---|
| 139 | </indexterm>
|
---|
| 140 | </listitem>
|
---|
| 141 | </varlistentry>
|
---|
| 142 |
|
---|
| 143 | <varlistentry id="c">
|
---|
| 144 | <term><command>c++</command></term>
|
---|
| 145 | <listitem>
|
---|
| 146 | <para>The C++ compiler</para>
|
---|
| 147 | <indexterm zone="ch-system-gcc c">
|
---|
| 148 | <primary sortas="b-c++">c++</primary>
|
---|
| 149 | </indexterm>
|
---|
| 150 | </listitem>
|
---|
| 151 | </varlistentry>
|
---|
| 152 |
|
---|
| 153 | <varlistentry id="g">
|
---|
| 154 | <term><command>g++</command></term>
|
---|
| 155 | <listitem>
|
---|
| 156 | <para>The C++ compiler</para>
|
---|
| 157 | <indexterm zone="ch-system-gcc g">
|
---|
| 158 | <primary sortas="b-g++">g++</primary>
|
---|
| 159 | </indexterm>
|
---|
| 160 | </listitem>
|
---|
| 161 | </varlistentry>
|
---|
| 162 |
|
---|
| 163 | <varlistentry id="gcc">
|
---|
| 164 | <term><command>gcc</command></term>
|
---|
| 165 | <listitem>
|
---|
| 166 | <para>The C compiler</para>
|
---|
| 167 | <indexterm zone="ch-system-gcc gcc">
|
---|
| 168 | <primary sortas="b-gcc">gcc</primary>
|
---|
| 169 | </indexterm>
|
---|
| 170 | </listitem>
|
---|
| 171 | </varlistentry>
|
---|
| 172 |
|
---|
| 173 | <varlistentry id="gccbug">
|
---|
| 174 | <term><command>gccbug</command></term>
|
---|
| 175 | <listitem>
|
---|
| 176 | <para>A shell script used to help create useful bug reports</para>
|
---|
| 177 | <indexterm zone="ch-system-gcc gccbug">
|
---|
| 178 | <primary sortas="b-gccbug">gccbug</primary>
|
---|
| 179 | </indexterm>
|
---|
| 180 | </listitem>
|
---|
| 181 | </varlistentry>
|
---|
| 182 |
|
---|
| 183 | <varlistentry id="gcov">
|
---|
| 184 | <term><command>gcov</command></term>
|
---|
| 185 | <listitem>
|
---|
| 186 | <para>A coverage testing tool; it is used to analyze programs to
|
---|
| 187 | determine where optimizations will have the most effect</para>
|
---|
| 188 | <indexterm zone="ch-system-gcc gcov">
|
---|
| 189 | <primary sortas="b-gcov">gcov</primary>
|
---|
| 190 | </indexterm>
|
---|
| 191 | </listitem>
|
---|
| 192 | </varlistentry>
|
---|
| 193 |
|
---|
| 194 | <varlistentry id="libgcc">
|
---|
| 195 | <term><filename class="libraryfile">libgcc</filename></term>
|
---|
| 196 | <listitem>
|
---|
| 197 | <para>Contains run-time support for <command>gcc</command></para>
|
---|
| 198 | <indexterm zone="ch-system-gcc libgcc">
|
---|
| 199 | <primary sortas="c-libgcc*">libgcc*</primary>
|
---|
| 200 | </indexterm>
|
---|
| 201 | </listitem>
|
---|
| 202 | </varlistentry>
|
---|
| 203 |
|
---|
| 204 | <varlistentry id="libmudflap">
|
---|
| 205 | <term><filename class="libraryfile">libmudflap</filename></term>
|
---|
| 206 | <listitem>
|
---|
| 207 | <para>The libmudflap libraries are used by GCC for instrumenting
|
---|
| 208 | pointer and array dereferencing operations.</para>
|
---|
| 209 | <indexterm zone="ch-system-gcc libmudflap">
|
---|
| 210 | <primary sortas="c-libmudflap*">libmudflap*</primary>
|
---|
| 211 | </indexterm>
|
---|
| 212 | </listitem>
|
---|
| 213 | </varlistentry>
|
---|
| 214 |
|
---|
| 215 | <varlistentry id="libstdc">
|
---|
| 216 | <term><filename class="libraryfile">libstdc++</filename></term>
|
---|
| 217 | <listitem>
|
---|
| 218 | <para>The standard C++ library</para>
|
---|
| 219 | <indexterm zone="ch-system-gcc libstdc">
|
---|
| 220 | <primary sortas="c-libstdc++">libstdc++</primary>
|
---|
| 221 | </indexterm>
|
---|
| 222 | </listitem>
|
---|
| 223 | </varlistentry>
|
---|
| 224 |
|
---|
| 225 | <varlistentry id="libsupc">
|
---|
| 226 | <term><filename class="libraryfile">libsupc++</filename></term>
|
---|
| 227 | <listitem>
|
---|
| 228 | <para>Provides supporting routines for the C++ programming
|
---|
| 229 | language</para>
|
---|
| 230 | <indexterm zone="ch-system-gcc libsupc">
|
---|
| 231 | <primary sortas="c-libsupc++">libsupc++</primary>
|
---|
| 232 | </indexterm>
|
---|
| 233 | </listitem>
|
---|
| 234 | </varlistentry>
|
---|
| 235 |
|
---|
| 236 | </variablelist>
|
---|
| 237 |
|
---|
| 238 | </sect2>
|
---|
| 239 |
|
---|
| 240 | </sect1>
|
---|