[2ff1ab9] | 1 | <sect2><title> </title><para> </para></sect2>
|
---|
| 2 |
|
---|
[6370fa6] | 3 | <sect2>
|
---|
| 4 | <title>Installation of GCC</title>
|
---|
| 5 |
|
---|
[ec0ce9c] | 6 | <note><para>The test suite for GCC in this section is considered
|
---|
| 7 | <emphasis>critical</emphasis>. Our advice is to not skip it under any
|
---|
| 8 | circumstance.</para></note>
|
---|
[1f53626] | 9 |
|
---|
[e69a59f] | 10 | <para>This package is known to behave badly when you have changed its
|
---|
[2b114b25] | 11 | default optimization flags (including the -march and -mcpu options).
|
---|
| 12 | Therefore, if you have defined any environment variables that override
|
---|
| 13 | default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting
|
---|
| 14 | or modifying them when building GCC.</para>
|
---|
[b43aab1] | 15 |
|
---|
[ae581da] | 16 | <para>This time we will build both the C and the C++ compiler, so you'll have
|
---|
| 17 | to unpack the GCC-core <emphasis>and</emphasis> the GCC-g++ tarball -- they
|
---|
[40b88c2] | 18 | will unfold into the same directory. You should likewise extract the
|
---|
| 19 | GCC-testsuite package. The full GCC package contains even more
|
---|
[ae581da] | 20 | compilers. Instructions for building these can be found at
|
---|
[f861982] | 21 | <ulink url="&blfs-root;view/stable/general/gcc.html"/>.</para>
|
---|
[2ff1ab9] | 22 |
|
---|
[3985670] | 23 | <para><screen><userinput>patch -Np1 -i ../gcc-&gcc-nofixincludes-patch-version;.patch
|
---|
| 24 | patch -Np1 -i ../gcc-&gcc-suppress-libiberty-patch-version;.patch</userinput></screen></para>
|
---|
[8998cde] | 25 |
|
---|
| 26 | <para>The second patch here suppresses the installation of libiberty from GCC,
|
---|
[f57e3d1] | 27 | as we will use the one provided by binutils instead. Be careful
|
---|
| 28 | <emphasis>not</emphasis> to apply the GCC specs patch from Chapter 5
|
---|
| 29 | here.</para>
|
---|
[bc82645e] | 30 |
|
---|
[677aef3] | 31 | <para>The GCC documentation recommends building GCC outside of the source
|
---|
| 32 | directory in a dedicated build directory:</para>
|
---|
[6370fa6] | 33 |
|
---|
[4a7a683] | 34 | <para><screen><userinput>mkdir ../gcc-build
|
---|
[2ff1ab9] | 35 | cd ../gcc-build</userinput></screen></para>
|
---|
| 36 |
|
---|
[ae581da] | 37 | <para>Now prepare GCC for compilation:</para>
|
---|
[2ff1ab9] | 38 |
|
---|
[84a7dc2] | 39 | <para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
|
---|
[bc82645e] | 40 | --enable-shared --enable-threads=posix \
|
---|
| 41 | --enable-__cxa_atexit --enable-clocale=gnu \
|
---|
[0939e573] | 42 | --enable-languages=c,c++</userinput></screen></para>
|
---|
[2ff1ab9] | 43 |
|
---|
[ae581da] | 44 | <para>Compile the package:</para>
|
---|
[2ff1ab9] | 45 |
|
---|
[84a7dc2] | 46 | <para><screen><userinput>make</userinput></screen></para>
|
---|
[2ff1ab9] | 47 |
|
---|
[89fcc34] | 48 | <para>Test the results, but don't stop at errors (you'll remember the few
|
---|
[ae581da] | 49 | known ones):</para>
|
---|
| 50 |
|
---|
[bc82645e] | 51 | <para><screen><userinput>make -k check</userinput></screen></para>
|
---|
[2ff1ab9] | 52 |
|
---|
[5331519] | 53 | <para>The test suite notes from the "Installing GCC - Pass 2" section in Chapter
|
---|
| 54 | 5 are still very much appropriate here. Be sure to refer back there should you
|
---|
| 55 | have any doubts.</para>
|
---|
| 56 |
|
---|
[f861982] | 57 | <para>The test suite notes from <xref linkend="ch05-gcc-pass2"/> are still very
|
---|
| 58 | much appropriate here. Be sure to refer back there should you have any
|
---|
| 59 | doubts.</para>
|
---|
| 60 |
|
---|
[ae581da] | 61 | <para>And install the package:</para>
|
---|
[2ff1ab9] | 62 |
|
---|
[bc82645e] | 63 | <para><screen><userinput>make install</userinput></screen></para>
|
---|
[2ff1ab9] | 64 |
|
---|
[7bfad05] | 65 | <para>Some packages expect the C PreProcessor to be installed in the
|
---|
[e7e5590] | 66 | <filename>/lib</filename> directory.
|
---|
| 67 | To honor those packages, create this symlink:</para>
|
---|
[2ff1ab9] | 68 |
|
---|
[6ab7740] | 69 | <para><screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen></para>
|
---|
[2ff1ab9] | 70 |
|
---|
[ae581da] | 71 | <para>Many packages use the name <userinput>cc</userinput> to call the C
|
---|
| 72 | compiler. To satisfy those packages, create a symlink:</para>
|
---|
[2ff1ab9] | 73 |
|
---|
| 74 | <para><screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen></para>
|
---|
[6370fa6] | 75 |
|
---|
[076ddfe] | 76 | <note><para>At this point it is strongly recommended to repeat the sanity check
|
---|
[f861982] | 77 | we performed earlier in the chapter. Refer back to
|
---|
| 78 | <xref linkend="ch06-adjustingtoolchain"/> and repeat the check. If the results
|
---|
| 79 | are wrong then most likely, you erroneously applied the GCC Specs patch from
|
---|
| 80 | Chapter 5.</para></note>
|
---|
[076ddfe] | 81 |
|
---|
[6370fa6] | 82 | </sect2>
|
---|