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