1 | <sect2><title> </title><para> </para></sect2>
|
---|
2 |
|
---|
3 | <sect2>
|
---|
4 | <title>Installation of GCC</title>
|
---|
5 |
|
---|
6 | <note><para>The testsuite for GCC in this chapter is considered <emphasis>
|
---|
7 | critical</emphasis>. Do not skip it under any circumstances.</para></note>
|
---|
8 |
|
---|
9 | <para>This package is known to behave badly when you have changed its
|
---|
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>
|
---|
14 |
|
---|
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
|
---|
17 | will unfold into the same directory. You should likewise extract the
|
---|
18 | GCC-testsuite package. The full GCC package contains even more
|
---|
19 | compilers. Instructions for building these can be found at
|
---|
20 | <ulink url="&blfs-root;view/cvs/general/gcc.html"/>.</para>
|
---|
21 |
|
---|
22 | <para><screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes-2.patch
|
---|
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>
|
---|
27 |
|
---|
28 | <para>GCC's installation documentation recommends to build the package in a
|
---|
29 | dedicated directory separate from the source tree. Create this build
|
---|
30 | directory and go there:</para>
|
---|
31 |
|
---|
32 | <para><screen><userinput>mkdir ../gcc-build
|
---|
33 | cd ../gcc-build</userinput></screen></para>
|
---|
34 |
|
---|
35 | <para>Now prepare GCC for compilation:</para>
|
---|
36 |
|
---|
37 | <para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
|
---|
38 | --enable-shared --enable-threads=posix \
|
---|
39 | --enable-__cxa_atexit --enable-clocale=gnu \
|
---|
40 | --enable-languages=c,c++</userinput></screen></para>
|
---|
41 |
|
---|
42 | <para>The meaning of the new configure options:</para>
|
---|
43 |
|
---|
44 | <itemizedlist>
|
---|
45 | <listitem><para><userinput>--enable-threads=posix</userinput>: This enables
|
---|
46 | C++ exception handling for multi-threaded code.</para></listitem>
|
---|
47 |
|
---|
48 | <listitem><para><userinput>--enable-__cxa_atexit</userinput>: This option
|
---|
49 | will result in C++ shared libraries and C++ programs that are interoperable
|
---|
50 | with other Linux distributions.</para></listitem>
|
---|
51 |
|
---|
52 | <listitem><para><userinput>--enable-clocale=gnu</userinput>: There is a risk
|
---|
53 | that some people will build ABI incompatible C++ libraries if they didn't
|
---|
54 | install all of the glibc localedata. Using --enable-clocale=gnu ensures that
|
---|
55 | the "right thing" is done in all cases. If you don't wish to use this option,
|
---|
56 | then at least build the <emphasis>de_DE</emphasis> locale. When GCC finds
|
---|
57 | this specific locale, then the correct locale mode (<emphasis>gnu</emphasis>)
|
---|
58 | is implemented.</para></listitem>
|
---|
59 | </itemizedlist>
|
---|
60 |
|
---|
61 | <para>Compile the package:</para>
|
---|
62 |
|
---|
63 | <para><screen><userinput>make</userinput></screen></para>
|
---|
64 |
|
---|
65 | <para>Test the results, but don't stop at errors (you'll remember the few
|
---|
66 | known ones):</para>
|
---|
67 |
|
---|
68 | <para><screen><userinput>make -k check</userinput></screen></para>
|
---|
69 |
|
---|
70 | <para>And install the package:</para>
|
---|
71 |
|
---|
72 | <para><screen><userinput>make install</userinput></screen></para>
|
---|
73 |
|
---|
74 | <para>Some packages expect the C PreProcessor to be installed in the
|
---|
75 | <filename>/lib</filename> directory.
|
---|
76 | To honor those packages, create this symlink:</para>
|
---|
77 |
|
---|
78 | <para><screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen></para>
|
---|
79 |
|
---|
80 | <para>Many packages use the name <userinput>cc</userinput> to call the C
|
---|
81 | compiler. To satisfy those packages, create a symlink:</para>
|
---|
82 |
|
---|
83 | <para><screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen></para>
|
---|
84 |
|
---|
85 | </sect2>
|
---|