[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 |
|
---|
[12e6567] | 25 | &env-target;
|
---|
| 26 |
|
---|
[02095ae] | 27 | <sect2 role="installation">
|
---|
| 28 | <title>Installation of GCC</title>
|
---|
| 29 |
|
---|
[7329dbe] | 30 | <para os="p3">The following patch contains a number of updates to the
|
---|
| 31 | &gcc-version; branch by the GCC developers:</para>
|
---|
| 32 |
|
---|
| 33 | <screen os="p4"><userinput>patch -Np1 -i ../&gcc-branch_update-patch;</userinput></screen>
|
---|
| 34 |
|
---|
[02095ae] | 35 | <para os="a">Apply a <command>sed</command> substitution that will suppress the
|
---|
| 36 | installation of <filename class="libraryfile">libiberty.a</filename>. The
|
---|
| 37 | version of <filename class="libraryfile">libiberty.a</filename> provided by
|
---|
| 38 | Binutils will be used instead:</para>
|
---|
| 39 |
|
---|
[7126617] | 40 | <screen os="b"><userinput>cp libiberty/Makefile.in{,.orig}
|
---|
[a074923] | 41 | sed 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in.orig > \
|
---|
| 42 | libiberty/Makefile.in</userinput></screen>
|
---|
[02095ae] | 43 |
|
---|
| 44 | <para os="e1">GCC provides a <command>gccbug</command> script which detects at
|
---|
[d30b2ab] | 45 | compile time whether <command>mktemp</command> is present, and hardcodes
|
---|
| 46 | the result in a test. If <command>mktemp</command> is not found, the
|
---|
| 47 | script will fall back to using less random names for temporary files.
|
---|
| 48 | <command>mktemp</command> will be installed as part of Coreutils
|
---|
| 49 | later, so the following <command>sed</command> will simulate its presence:</para>
|
---|
[02095ae] | 50 |
|
---|
[7126617] | 51 | <screen os="e2"><userinput>cp gcc/gccbug.in{,.orig}
|
---|
[73b1cbb] | 52 | sed 's/@have_mktemp_command@/yes/' gcc/gccbug.in.orig > gcc/gccbug.in</userinput></screen>
|
---|
[02095ae] | 53 |
|
---|
[d30b2ab] | 54 | <para os="s1">The <command>fixincludes</command> script attempts to "fix"
|
---|
| 55 | the system headers installed so far. Since GCC is cross-compiled expecting
|
---|
| 56 | the system headers to be in <filename class="directory">/usr/include</filename>,
|
---|
| 57 | the script will be looking at the host system's headers. The following sed
|
---|
| 58 | prevents <command>fixincludes</command> from running:</para>
|
---|
[c0cd0ca] | 59 |
|
---|
| 60 | <screen os="s2"><userinput>cp gcc/Makefile.in{,.orig}
|
---|
[73b1cbb] | 61 | sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in</userinput></screen>
|
---|
[c0cd0ca] | 62 |
|
---|
[02095ae] | 63 | <para os="c">The GCC documentation recommends building GCC outside of the source
|
---|
| 64 | directory in a dedicated build directory:</para>
|
---|
| 65 |
|
---|
| 66 | <screen os="d"><userinput>mkdir -v ../gcc-build
|
---|
| 67 | cd ../gcc-build</userinput></screen>
|
---|
| 68 |
|
---|
| 69 | <para os="e">Prepare GCC for compilation:</para>
|
---|
| 70 |
|
---|
[625455a] | 71 | <screen os="f"><userinput>LDFLAGS="-Wl,-rpath-link,${CLFS}/cross-tools/${CLFS_TARGET}/lib" \
|
---|
| 72 | ../gcc-&gcc-version;/configure --prefix=/usr --libexecdir=/usr/lib \
|
---|
[586feb7] | 73 | --build=${CLFS_HOST} --host=${CLFS_TARGET} --target=${CLFS_TARGET} \
|
---|
[02095ae] | 74 | --enable-shared --enable-threads=posix --enable-__cxa_atexit \
|
---|
| 75 | --enable-c99 --enable-long-long --enable-clocale=gnu \
|
---|
| 76 | --enable-languages=c,c++ --disable-libstdcxx-pch</userinput></screen>
|
---|
| 77 |
|
---|
[625455a] | 78 | <para os="ts1">The following will prevent GCC from looking in the wrong
|
---|
| 79 | directories for headers and libraries:</para>
|
---|
| 80 |
|
---|
| 81 | <screen os="ts2"><userinput>cp Makefile{,.orig}
|
---|
| 82 | sed "/^HOST_\(GMP\|PPL\|CLOOG\)\(LIBS\|INC\)/s:-[IL]/\(lib\|include\)::" \
|
---|
| 83 | Makefile.orig > Makefile</userinput></screen>
|
---|
| 84 |
|
---|
[02095ae] | 85 | <para os="g">Compile the package:</para>
|
---|
| 86 |
|
---|
| 87 | <screen os="h"><userinput>make</userinput></screen>
|
---|
| 88 |
|
---|
| 89 | <para os="i">Install the package:</para>
|
---|
| 90 |
|
---|
[586feb7] | 91 | <screen os="j"><userinput>make DESTDIR=${CLFS} install</userinput></screen>
|
---|
[02095ae] | 92 |
|
---|
| 93 | <para os="k">Some packages expect the C preprocessor to be installed in the
|
---|
| 94 | <filename class="directory">/lib</filename> directory.
|
---|
| 95 | To support those packages, create this symlink:</para>
|
---|
| 96 |
|
---|
[7e336f1] | 97 | <screen os="l"><userinput>ln -sfv ../usr/bin/cpp ${CLFS}/lib</userinput></screen>
|
---|
[02095ae] | 98 |
|
---|
| 99 | <para os="m">Many packages use the name <command>cc</command> to call the C
|
---|
| 100 | compiler. To satisfy those packages, create a symlink:</para>
|
---|
| 101 |
|
---|
[7e336f1] | 102 | <screen os="o"><userinput>ln -sfv gcc ${CLFS}/usr/bin/cc</userinput></screen>
|
---|
[02095ae] | 103 |
|
---|
| 104 | </sect2>
|
---|
| 105 |
|
---|
| 106 | <sect2 id="contents-gcc" role="content">
|
---|
| 107 | <title>Contents of GCC</title>
|
---|
| 108 |
|
---|
| 109 | <segmentedlist>
|
---|
| 110 | <segtitle>Installed programs</segtitle>
|
---|
| 111 | <segtitle>Installed libraries</segtitle>
|
---|
| 112 |
|
---|
| 113 | <seglistitem>
|
---|
| 114 | <seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcov</seg>
|
---|
[c213baf] | 115 | <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libgomp.[a,so], libmudflap.[a,so],
|
---|
| 116 | libmudflapth.[a,so], libssp.[a,so], libstdc++.[a,so], and
|
---|
[02095ae] | 117 | libsupc++.a</seg>
|
---|
| 118 | </seglistitem>
|
---|
| 119 | </segmentedlist>
|
---|
| 120 |
|
---|
| 121 | <variablelist>
|
---|
| 122 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 123 | <?dbfo list-presentation="list"?>
|
---|
| 124 | <?dbhtml list-presentation="table"?>
|
---|
| 125 |
|
---|
| 126 | <varlistentry id="cc">
|
---|
| 127 | <term><command>cc</command></term>
|
---|
| 128 | <listitem>
|
---|
| 129 | <para>The C compiler</para>
|
---|
| 130 | <indexterm zone="ch-system-gcc cc">
|
---|
| 131 | <primary sortas="b-cc">cc</primary>
|
---|
| 132 | </indexterm>
|
---|
| 133 | </listitem>
|
---|
| 134 | </varlistentry>
|
---|
| 135 |
|
---|
| 136 | <varlistentry id="cpp">
|
---|
| 137 | <term><command>cpp</command></term>
|
---|
| 138 | <listitem>
|
---|
| 139 | <para>The C preprocessor; it is used by the compiler to expand the
|
---|
| 140 | #include, #define, and similar statements in the source files</para>
|
---|
| 141 | <indexterm zone="ch-system-gcc cpp">
|
---|
| 142 | <primary sortas="b-cpp">cpp</primary>
|
---|
| 143 | </indexterm>
|
---|
| 144 | </listitem>
|
---|
| 145 | </varlistentry>
|
---|
| 146 |
|
---|
| 147 | <varlistentry id="c">
|
---|
| 148 | <term><command>c++</command></term>
|
---|
| 149 | <listitem>
|
---|
| 150 | <para>The C++ compiler</para>
|
---|
| 151 | <indexterm zone="ch-system-gcc c">
|
---|
| 152 | <primary sortas="b-c++">c++</primary>
|
---|
| 153 | </indexterm>
|
---|
| 154 | </listitem>
|
---|
| 155 | </varlistentry>
|
---|
| 156 |
|
---|
| 157 | <varlistentry id="g">
|
---|
| 158 | <term><command>g++</command></term>
|
---|
| 159 | <listitem>
|
---|
| 160 | <para>The C++ compiler</para>
|
---|
| 161 | <indexterm zone="ch-system-gcc g">
|
---|
| 162 | <primary sortas="b-g++">g++</primary>
|
---|
| 163 | </indexterm>
|
---|
| 164 | </listitem>
|
---|
| 165 | </varlistentry>
|
---|
| 166 |
|
---|
| 167 | <varlistentry id="gcc">
|
---|
| 168 | <term><command>gcc</command></term>
|
---|
| 169 | <listitem>
|
---|
| 170 | <para>The C compiler</para>
|
---|
| 171 | <indexterm zone="ch-system-gcc gcc">
|
---|
| 172 | <primary sortas="b-gcc">gcc</primary>
|
---|
| 173 | </indexterm>
|
---|
| 174 | </listitem>
|
---|
| 175 | </varlistentry>
|
---|
| 176 |
|
---|
| 177 | <varlistentry id="gccbug">
|
---|
| 178 | <term><command>gccbug</command></term>
|
---|
| 179 | <listitem>
|
---|
| 180 | <para>A shell script used to help create useful bug reports</para>
|
---|
| 181 | <indexterm zone="ch-system-gcc gccbug">
|
---|
| 182 | <primary sortas="b-gccbug">gccbug</primary>
|
---|
| 183 | </indexterm>
|
---|
| 184 | </listitem>
|
---|
| 185 | </varlistentry>
|
---|
| 186 |
|
---|
| 187 | <varlistentry id="gcov">
|
---|
| 188 | <term><command>gcov</command></term>
|
---|
| 189 | <listitem>
|
---|
| 190 | <para>A coverage testing tool; it is used to analyze programs to
|
---|
| 191 | determine where optimizations will have the most effect</para>
|
---|
| 192 | <indexterm zone="ch-system-gcc gcov">
|
---|
| 193 | <primary sortas="b-gcov">gcov</primary>
|
---|
| 194 | </indexterm>
|
---|
| 195 | </listitem>
|
---|
| 196 | </varlistentry>
|
---|
| 197 |
|
---|
| 198 | <varlistentry id="libgcc">
|
---|
| 199 | <term><filename class="libraryfile">libgcc</filename></term>
|
---|
| 200 | <listitem>
|
---|
| 201 | <para>Contains run-time support for <command>gcc</command></para>
|
---|
| 202 | <indexterm zone="ch-system-gcc libgcc">
|
---|
| 203 | <primary sortas="c-libgcc*">libgcc*</primary>
|
---|
| 204 | </indexterm>
|
---|
| 205 | </listitem>
|
---|
| 206 | </varlistentry>
|
---|
| 207 |
|
---|
| 208 | <varlistentry id="libmudflap">
|
---|
| 209 | <term><filename class="libraryfile">libmudflap</filename></term>
|
---|
| 210 | <listitem>
|
---|
| 211 | <para>The libmudflap libraries are used by GCC for instrumenting
|
---|
| 212 | pointer and array dereferencing operations.</para>
|
---|
| 213 | <indexterm zone="ch-system-gcc libmudflap">
|
---|
| 214 | <primary sortas="c-libmudflap*">libmudflap*</primary>
|
---|
| 215 | </indexterm>
|
---|
| 216 | </listitem>
|
---|
| 217 | </varlistentry>
|
---|
| 218 |
|
---|
| 219 | <varlistentry id="libstdc">
|
---|
| 220 | <term><filename class="libraryfile">libstdc++</filename></term>
|
---|
| 221 | <listitem>
|
---|
| 222 | <para>The standard C++ library</para>
|
---|
| 223 | <indexterm zone="ch-system-gcc libstdc">
|
---|
| 224 | <primary sortas="c-libstdc++">libstdc++</primary>
|
---|
| 225 | </indexterm>
|
---|
| 226 | </listitem>
|
---|
| 227 | </varlistentry>
|
---|
| 228 |
|
---|
| 229 | <varlistentry id="libsupc">
|
---|
| 230 | <term><filename class="libraryfile">libsupc++</filename></term>
|
---|
| 231 | <listitem>
|
---|
| 232 | <para>Provides supporting routines for the C++ programming
|
---|
| 233 | language</para>
|
---|
| 234 | <indexterm zone="ch-system-gcc libsupc">
|
---|
| 235 | <primary sortas="c-libsupc++">libsupc++</primary>
|
---|
| 236 | </indexterm>
|
---|
| 237 | </listitem>
|
---|
| 238 | </varlistentry>
|
---|
| 239 |
|
---|
| 240 | </variablelist>
|
---|
| 241 |
|
---|
| 242 | </sect2>
|
---|
| 243 |
|
---|
| 244 | </sect1>
|
---|