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