gcc-inst.xml 3.4 KB

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