| [bf8c11f] | 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 | <segmentedlist> | 
|---|
|  | 24 | <segtitle>&dependencies;</segtitle> | 
|---|
|  | 25 |  | 
|---|
|  | 26 | <seglistitem> | 
|---|
| [0636f6c] | 27 | <seg>Bash, Binutils, Coreutils, DejaGNU, Diffutils, Expect, Findutils, | 
|---|
|  | 28 | Gawk, Gettext, Glibc, Grep, Make, Patch, Perl, Sed, Tcl, and Texinfo</seg> | 
|---|
| [bf8c11f] | 29 | </seglistitem> | 
|---|
|  | 30 | </segmentedlist> | 
|---|
|  | 31 |  | 
|---|
|  | 32 | </sect2> | 
|---|
|  | 33 |  | 
|---|
|  | 34 | <sect2 role="installation"> | 
|---|
|  | 35 | <title>Installation of GCC</title> | 
|---|
|  | 36 |  | 
|---|
| [a9fe0ce] | 37 | <para os="p1">The following patch fixes an issue where gcc doesn't generate | 
|---|
|  | 38 | some code properly.</para> | 
|---|
|  | 39 |  | 
|---|
|  | 40 | <screen os="p2"><userinput>patch -Np1 -i ../&gcc-fold_const-patch;</userinput></screen> | 
|---|
|  | 41 |  | 
|---|
| [bf8c11f] | 42 | <para os="d">Apply a <command>sed</command> substitution that will suppress the | 
|---|
|  | 43 | installation of <filename class="libraryfile">libiberty.a</filename>. The | 
|---|
|  | 44 | version of <filename class="libraryfile">libiberty.a</filename> provided by | 
|---|
|  | 45 | Binutils will be used instead:</para> | 
|---|
|  | 46 |  | 
|---|
|  | 47 | <screen os="e"><userinput>sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen> | 
|---|
|  | 48 |  | 
|---|
| [9be8160] | 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 | This will cause the script to fall back to using less random names for | 
|---|
|  | 52 | temporary files.  We will be installing mktemp later, so the following sed | 
|---|
|  | 53 | will simulate its presence.</para> | 
|---|
|  | 54 |  | 
|---|
| [62c1c5dd] | 55 | <screen os="e2"><userinput>sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in</userinput></screen> | 
|---|
| [9be8160] | 56 |  | 
|---|
| [bf8c11f] | 57 | <para os="f">The GCC documentation recommends building GCC outside of the source | 
|---|
|  | 58 | directory in a dedicated build directory:</para> | 
|---|
|  | 59 |  | 
|---|
| [dd9906e] | 60 | <screen os="g"><userinput>mkdir -v ../gcc-build | 
|---|
| [bf8c11f] | 61 | cd ../gcc-build</userinput></screen> | 
|---|
|  | 62 |  | 
|---|
|  | 63 | <para os="h">Prepare GCC for compilation:</para> | 
|---|
|  | 64 |  | 
|---|
| [1b823a37] | 65 | <screen os="i"><userinput>../gcc-&gcc-version;/configure --prefix=/usr \ | 
|---|
| [bf8c11f] | 66 | --libexecdir=/usr/lib --enable-shared --enable-threads=posix \ | 
|---|
|  | 67 | --enable-__cxa_atexit --enable-c99 --enable-long-long \ | 
|---|
| [11a722f] | 68 | --enable-clocale=gnu --enable-languages=c,c++ \ | 
|---|
| [adeb68a] | 69 | --disable-multilib --disable-libstdcxx-pch</userinput></screen> | 
|---|
| [bf8c11f] | 70 |  | 
|---|
| [1b823a37] | 71 | <para os="j">Compile the package:</para> | 
|---|
| [bf8c11f] | 72 |  | 
|---|
| [c5ff986] | 73 | <screen os="k"><userinput>make bootstrap</userinput></screen> | 
|---|
| [bf8c11f] | 74 |  | 
|---|
| [1b823a37] | 75 | <important os="l"> | 
|---|
| [bf8c11f] | 76 | <para>In this section, the test suite for GCC is considered | 
|---|
|  | 77 | critical. Do not skip it under any circumstance.</para> | 
|---|
|  | 78 | </important> | 
|---|
|  | 79 |  | 
|---|
| [1b823a37] | 80 | <para os="m">Test the results, but do not stop at errors:</para> | 
|---|
| [bf8c11f] | 81 |  | 
|---|
| [1b823a37] | 82 | <screen os="n"><userinput>make -k check</userinput></screen> | 
|---|
| [bf8c11f] | 83 |  | 
|---|
| [1b823a37] | 84 | <para os="o">The <parameter>-k</parameter> flag is used to make the test suite | 
|---|
| [bf8c11f] | 85 | run through to completion and not stop at the first failure. The GCC test | 
|---|
|  | 86 | suite is very comprehensive and is almost guaranteed to generate a few | 
|---|
|  | 87 | failures. To receive a summary of the test suite results, run:</para> | 
|---|
|  | 88 |  | 
|---|
| [1b823a37] | 89 | <screen os="p"><userinput>../gcc-&gcc-version;/contrib/test_summary</userinput></screen> | 
|---|
| [bf8c11f] | 90 |  | 
|---|
| [1b823a37] | 91 | <para os="q">For only the summaries, pipe the output through | 
|---|
| [bf8c11f] | 92 | <userinput>grep -A7 Summ</userinput>.</para> | 
|---|
|  | 93 |  | 
|---|
|  | 94 | <para os="r">A few unexpected failures cannot always be avoided. The | 
|---|
|  | 95 | GCC developers are usually aware of these issues, but have not | 
|---|
| [1b823a37] | 96 | resolved them yet.</para> | 
|---|
| [bf8c11f] | 97 |  | 
|---|
|  | 98 | <para os="s">Install the package:</para> | 
|---|
|  | 99 |  | 
|---|
|  | 100 | <screen os="t"><userinput>make install</userinput></screen> | 
|---|
|  | 101 |  | 
|---|
|  | 102 | <para os="u">Some packages expect the C preprocessor to be installed in the | 
|---|
|  | 103 | <filename class="directory">/lib</filename> directory. | 
|---|
|  | 104 | To support those packages, create this symlink:</para> | 
|---|
|  | 105 |  | 
|---|
| [dd9906e] | 106 | <screen os="v"><userinput>ln -sv ../usr/bin/cpp /lib</userinput></screen> | 
|---|
| [bf8c11f] | 107 |  | 
|---|
|  | 108 | <para os="w">Many packages use the name <command>cc</command> to call the C | 
|---|
|  | 109 | compiler. To satisfy those packages, create a symlink:</para> | 
|---|
|  | 110 |  | 
|---|
| [dd9906e] | 111 | <screen os="x"><userinput>ln -sv gcc /usr/bin/cc</userinput></screen> | 
|---|
| [bf8c11f] | 112 |  | 
|---|
|  | 113 | </sect2> | 
|---|
|  | 114 |  | 
|---|
|  | 115 | <sect2 id="contents-gcc" role="content"> | 
|---|
|  | 116 | <title>Contents of GCC</title> | 
|---|
|  | 117 |  | 
|---|
|  | 118 | <segmentedlist> | 
|---|
|  | 119 | <segtitle>Installed programs</segtitle> | 
|---|
|  | 120 | <segtitle>Installed libraries</segtitle> | 
|---|
|  | 121 |  | 
|---|
|  | 122 | <seglistitem> | 
|---|
|  | 123 | <seg>c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcov</seg> | 
|---|
| [1b823a37] | 124 | <seg>libgcc.a, libgcc_eh.a, libgcc_s.so, libmudflap.[a,so], | 
|---|
|  | 125 | libmudflapth.[a,so], libstdc++.[a,so], and | 
|---|
| [bf8c11f] | 126 | libsupc++.a</seg> | 
|---|
|  | 127 | </seglistitem> | 
|---|
|  | 128 | </segmentedlist> | 
|---|
|  | 129 |  | 
|---|
|  | 130 | <variablelist> | 
|---|
|  | 131 | <bridgehead renderas="sect3">Short Descriptions</bridgehead> | 
|---|
|  | 132 | <?dbfo list-presentation="list"?> | 
|---|
|  | 133 | <?dbhtml list-presentation="table"?> | 
|---|
|  | 134 |  | 
|---|
|  | 135 | <varlistentry id="cc"> | 
|---|
|  | 136 | <term><command>cc</command></term> | 
|---|
|  | 137 | <listitem> | 
|---|
|  | 138 | <para>The C compiler</para> | 
|---|
|  | 139 | <indexterm zone="ch-system-gcc cc"> | 
|---|
|  | 140 | <primary sortas="b-cc">cc</primary> | 
|---|
|  | 141 | </indexterm> | 
|---|
|  | 142 | </listitem> | 
|---|
|  | 143 | </varlistentry> | 
|---|
|  | 144 |  | 
|---|
|  | 145 | <varlistentry id="cpp"> | 
|---|
|  | 146 | <term><command>cpp</command></term> | 
|---|
|  | 147 | <listitem> | 
|---|
|  | 148 | <para>The C preprocessor; it is used by the compiler to expand the | 
|---|
|  | 149 | #include, #define, and similar statements in the source files</para> | 
|---|
|  | 150 | <indexterm zone="ch-system-gcc cpp"> | 
|---|
|  | 151 | <primary sortas="b-cpp">cpp</primary> | 
|---|
|  | 152 | </indexterm> | 
|---|
|  | 153 | </listitem> | 
|---|
|  | 154 | </varlistentry> | 
|---|
|  | 155 |  | 
|---|
|  | 156 | <varlistentry id="c"> | 
|---|
|  | 157 | <term><command>c++</command></term> | 
|---|
|  | 158 | <listitem> | 
|---|
|  | 159 | <para>The C++ compiler</para> | 
|---|
|  | 160 | <indexterm zone="ch-system-gcc c"> | 
|---|
|  | 161 | <primary sortas="b-c++">c++</primary> | 
|---|
|  | 162 | </indexterm> | 
|---|
|  | 163 | </listitem> | 
|---|
|  | 164 | </varlistentry> | 
|---|
|  | 165 |  | 
|---|
|  | 166 | <varlistentry id="g"> | 
|---|
|  | 167 | <term><command>g++</command></term> | 
|---|
|  | 168 | <listitem> | 
|---|
|  | 169 | <para>The C++ compiler</para> | 
|---|
|  | 170 | <indexterm zone="ch-system-gcc g"> | 
|---|
|  | 171 | <primary sortas="b-g++">g++</primary> | 
|---|
|  | 172 | </indexterm> | 
|---|
|  | 173 | </listitem> | 
|---|
|  | 174 | </varlistentry> | 
|---|
|  | 175 |  | 
|---|
|  | 176 | <varlistentry id="gcc"> | 
|---|
|  | 177 | <term><command>gcc</command></term> | 
|---|
|  | 178 | <listitem> | 
|---|
|  | 179 | <para>The C compiler</para> | 
|---|
|  | 180 | <indexterm zone="ch-system-gcc gcc"> | 
|---|
|  | 181 | <primary sortas="b-gcc">gcc</primary> | 
|---|
|  | 182 | </indexterm> | 
|---|
|  | 183 | </listitem> | 
|---|
|  | 184 | </varlistentry> | 
|---|
|  | 185 |  | 
|---|
|  | 186 | <varlistentry id="gccbug"> | 
|---|
|  | 187 | <term><command>gccbug</command></term> | 
|---|
|  | 188 | <listitem> | 
|---|
|  | 189 | <para>A shell script used to help create useful bug reports</para> | 
|---|
|  | 190 | <indexterm zone="ch-system-gcc gccbug"> | 
|---|
|  | 191 | <primary sortas="b-gccbug">gccbug</primary> | 
|---|
|  | 192 | </indexterm> | 
|---|
|  | 193 | </listitem> | 
|---|
|  | 194 | </varlistentry> | 
|---|
|  | 195 |  | 
|---|
|  | 196 | <varlistentry id="gcov"> | 
|---|
|  | 197 | <term><command>gcov</command></term> | 
|---|
|  | 198 | <listitem> | 
|---|
|  | 199 | <para>A coverage testing tool; it is used to analyze programs to | 
|---|
|  | 200 | determine where optimizations will have the most effect</para> | 
|---|
|  | 201 | <indexterm zone="ch-system-gcc gcov"> | 
|---|
|  | 202 | <primary sortas="b-gcov">gcov</primary> | 
|---|
|  | 203 | </indexterm> | 
|---|
|  | 204 | </listitem> | 
|---|
|  | 205 | </varlistentry> | 
|---|
|  | 206 |  | 
|---|
|  | 207 | <varlistentry id="libgcc"> | 
|---|
|  | 208 | <term><filename class="libraryfile">libgcc</filename></term> | 
|---|
|  | 209 | <listitem> | 
|---|
|  | 210 | <para>Contains run-time support for <command>gcc</command></para> | 
|---|
|  | 211 | <indexterm zone="ch-system-gcc libgcc"> | 
|---|
|  | 212 | <primary sortas="c-libgcc*">libgcc*</primary> | 
|---|
|  | 213 | </indexterm> | 
|---|
|  | 214 | </listitem> | 
|---|
|  | 215 | </varlistentry> | 
|---|
|  | 216 |  | 
|---|
| [4dea801f] | 217 | <varlistentry id="libmudflap"> | 
|---|
|  | 218 | <term><filename class="libraryfile">libmudflap</filename></term> | 
|---|
|  | 219 | <listitem> | 
|---|
|  | 220 | <para>The libmudflap libraries are used by GCC for instrumenting | 
|---|
| [155e089] | 221 | pointer and array dereferencing operations.</para> | 
|---|
| [4dea801f] | 222 | <indexterm zone="ch-system-gcc libmudflap"> | 
|---|
|  | 223 | <primary sortas="c-libmudflap*">libmudflap*</primary> | 
|---|
|  | 224 | </indexterm> | 
|---|
|  | 225 | </listitem> | 
|---|
|  | 226 | </varlistentry> | 
|---|
|  | 227 |  | 
|---|
| [bf8c11f] | 228 | <varlistentry id="libstdc"> | 
|---|
|  | 229 | <term><filename class="libraryfile">libstdc++</filename></term> | 
|---|
|  | 230 | <listitem> | 
|---|
|  | 231 | <para>The standard C++ library</para> | 
|---|
|  | 232 | <indexterm zone="ch-system-gcc libstdc"> | 
|---|
|  | 233 | <primary sortas="c-libstdc++">libstdc++</primary> | 
|---|
|  | 234 | </indexterm> | 
|---|
|  | 235 | </listitem> | 
|---|
|  | 236 | </varlistentry> | 
|---|
|  | 237 |  | 
|---|
|  | 238 | <varlistentry id="libsupc"> | 
|---|
|  | 239 | <term><filename class="libraryfile">libsupc++</filename></term> | 
|---|
|  | 240 | <listitem> | 
|---|
|  | 241 | <para>Provides supporting routines for the C++ programming | 
|---|
|  | 242 | language</para> | 
|---|
|  | 243 | <indexterm zone="ch-system-gcc libsupc"> | 
|---|
|  | 244 | <primary sortas="c-libsupc++">libsupc++</primary> | 
|---|
|  | 245 | </indexterm> | 
|---|
|  | 246 | </listitem> | 
|---|
|  | 247 | </varlistentry> | 
|---|
|  | 248 |  | 
|---|
|  | 249 | </variablelist> | 
|---|
|  | 250 |  | 
|---|
|  | 251 | </sect2> | 
|---|
|  | 252 |  | 
|---|
|  | 253 | </sect1> | 
|---|