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