[2ff1ab9] | 1 | <sect2><title> </title><para> </para></sect2>
|
---|
| 2 |
|
---|
[6370fa6] | 3 | <sect2>
|
---|
| 4 | <title>Installation of GCC</title>
|
---|
| 5 |
|
---|
[297d8ee0] | 6 | <note><para>The test suite for GCC in this section is considered <emphasis>
|
---|
[1f53626] | 7 | critical</emphasis>. Do not skip it under any circumstances.</para></note>
|
---|
| 8 |
|
---|
[e69a59f] | 9 | <para>This package is known to behave badly when you have changed its
|
---|
[2b114b25] | 10 | default optimization flags (including the -march and -mcpu options).
|
---|
| 11 | Therefore, if you have defined any environment variables that override
|
---|
| 12 | default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting
|
---|
| 13 | or modifying them when building GCC.</para>
|
---|
[b43aab1] | 14 |
|
---|
[ae581da] | 15 | <para>This time we will build both the C and the C++ compiler, so you'll have
|
---|
| 16 | to unpack the GCC-core <emphasis>and</emphasis> the GCC-g++ tarball -- they
|
---|
[40b88c2] | 17 | will unfold into the same directory. You should likewise extract the
|
---|
| 18 | GCC-testsuite package. The full GCC package contains even more
|
---|
[ae581da] | 19 | compilers. Instructions for building these can be found at
|
---|
| 20 | <ulink url="&blfs-root;view/cvs/general/gcc.html"/>.</para>
|
---|
[2ff1ab9] | 21 |
|
---|
[b19d5f96] | 22 | <para><screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes-2.patch
|
---|
[8998cde] | 23 | patch -Np1 -i ../gcc-3.3.1-suppress-libiberty.patch</userinput></screen></para>
|
---|
| 24 |
|
---|
| 25 | <para>The second patch here suppresses the installation of libiberty from GCC,
|
---|
| 26 | as we will use the one provided by binutils instead.</para>
|
---|
[bc82645e] | 27 |
|
---|
[677aef3] | 28 | <para>The GCC documentation recommends building GCC outside of the source
|
---|
| 29 | directory in a dedicated build directory:</para>
|
---|
[6370fa6] | 30 |
|
---|
[4a7a683] | 31 | <para><screen><userinput>mkdir ../gcc-build
|
---|
[2ff1ab9] | 32 | cd ../gcc-build</userinput></screen></para>
|
---|
| 33 |
|
---|
[ae581da] | 34 | <para>Now prepare GCC for compilation:</para>
|
---|
[2ff1ab9] | 35 |
|
---|
[84a7dc2] | 36 | <para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
|
---|
[bc82645e] | 37 | --enable-shared --enable-threads=posix \
|
---|
| 38 | --enable-__cxa_atexit --enable-clocale=gnu \
|
---|
[0939e573] | 39 | --enable-languages=c,c++</userinput></screen></para>
|
---|
[2ff1ab9] | 40 |
|
---|
[ae581da] | 41 | <para>The meaning of the new configure options:</para>
|
---|
[2ff1ab9] | 42 |
|
---|
| 43 | <itemizedlist>
|
---|
[e4b9338] | 44 | <listitem><para><userinput>--enable-threads=posix</userinput>: This enables
|
---|
[2ff1ab9] | 45 | C++ exception handling for multi-threaded code.</para></listitem>
|
---|
| 46 |
|
---|
[e4b9338] | 47 | <listitem><para><userinput>--enable-__cxa_atexit</userinput>: This option
|
---|
[2ff1ab9] | 48 | will result in C++ shared libraries and C++ programs that are interoperable
|
---|
| 49 | with other Linux distributions.</para></listitem>
|
---|
| 50 |
|
---|
[e4b9338] | 51 | <listitem><para><userinput>--enable-clocale=gnu</userinput>: There is a risk
|
---|
[2ff1ab9] | 52 | that some people will build ABI incompatible C++ libraries if they didn't
|
---|
| 53 | install all of the glibc localedata. Using --enable-clocale=gnu ensures that
|
---|
| 54 | the "right thing" is done in all cases. If you don't wish to use this option,
|
---|
| 55 | then at least build the <emphasis>de_DE</emphasis> locale. When GCC finds
|
---|
| 56 | this specific locale, then the correct locale mode (<emphasis>gnu</emphasis>)
|
---|
| 57 | is implemented.</para></listitem>
|
---|
| 58 | </itemizedlist>
|
---|
| 59 |
|
---|
[ae581da] | 60 | <para>Compile the package:</para>
|
---|
[2ff1ab9] | 61 |
|
---|
[84a7dc2] | 62 | <para><screen><userinput>make</userinput></screen></para>
|
---|
[2ff1ab9] | 63 |
|
---|
[89fcc34] | 64 | <para>Test the results, but don't stop at errors (you'll remember the few
|
---|
[ae581da] | 65 | known ones):</para>
|
---|
| 66 |
|
---|
[bc82645e] | 67 | <para><screen><userinput>make -k check</userinput></screen></para>
|
---|
[2ff1ab9] | 68 |
|
---|
[ae581da] | 69 | <para>And install the package:</para>
|
---|
[2ff1ab9] | 70 |
|
---|
[bc82645e] | 71 | <para><screen><userinput>make install</userinput></screen></para>
|
---|
[2ff1ab9] | 72 |
|
---|
[7bfad05] | 73 | <para>Some packages expect the C PreProcessor to be installed in the
|
---|
[e7e5590] | 74 | <filename>/lib</filename> directory.
|
---|
| 75 | To honor those packages, create this symlink:</para>
|
---|
[2ff1ab9] | 76 |
|
---|
[6ab7740] | 77 | <para><screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen></para>
|
---|
[2ff1ab9] | 78 |
|
---|
[ae581da] | 79 | <para>Many packages use the name <userinput>cc</userinput> to call the C
|
---|
| 80 | compiler. To satisfy those packages, create a symlink:</para>
|
---|
[2ff1ab9] | 81 |
|
---|
| 82 | <para><screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen></para>
|
---|
[6370fa6] | 83 |
|
---|
| 84 | </sect2>
|
---|