gcc-inst.xml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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>We will be building the C and C++ compilers at this time, so you'll
  10. need to unpack both the gcc-core and gcc-g++ tarballs. Other compilers are
  11. available in the full gcc package; instructions for building them may be
  12. found at <ulink url="&blfs-root;view/cvs/general/gcc.html"/>.</para>
  13. <para><screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes.patch
  14. patch -Np1 -i ../gcc-&gcc-version;-mmap_test.patch</userinput></screen></para>
  15. <para>It is recommended by the GCC installation documentation to build GCC
  16. in a dedicated directory outside of the source tree. Create the build
  17. directory:</para>
  18. <para><screen><userinput>mkdir ../gcc-build
  19. cd ../gcc-build</userinput></screen></para>
  20. <para>Prepare GCC to be compiled:</para>
  21. <para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
  22. &nbsp;&nbsp;&nbsp;&nbsp;--enable-shared --enable-threads=posix \
  23. &nbsp;&nbsp;&nbsp;&nbsp;--enable-__cxa_atexit --enable-clocale=gnu \
  24. &nbsp;&nbsp;&nbsp;&nbsp;--enable-languages=c,c++</userinput></screen></para>
  25. <para>The meanings of the configure options are:</para>
  26. <itemizedlist>
  27. <listitem><para><userinput>--enable-threads=posix</userinput>: This enables
  28. C++ exception handling for multi-threaded code.</para></listitem>
  29. <listitem><para><userinput>--enable-__cxa_atexit</userinput>: This option
  30. will result in C++ shared libraries and C++ programs that are interoperable
  31. with other Linux distributions.</para></listitem>
  32. <listitem><para><userinput>--enable-clocale=gnu</userinput>: There is a risk
  33. that some people will build ABI incompatible C++ libraries if they didn't
  34. install all of the glibc localedata. Using --enable-clocale=gnu ensures that
  35. the "right thing" is done in all cases. If you don't wish to use this option,
  36. then at least build the <emphasis>de_DE</emphasis> locale. When GCC finds
  37. this specific locale, then the correct locale mode (<emphasis>gnu</emphasis>)
  38. is implemented.</para></listitem>
  39. </itemizedlist>
  40. <para>Continue with compiling the package:</para>
  41. <para><screen><userinput>make</userinput></screen></para>
  42. <para><screen><userinput>make -k check</userinput></screen></para>
  43. <para>Finish installing the package:</para>
  44. <para><screen><userinput>make install</userinput></screen></para>
  45. <para>Some packages expect the C PreProcessor to be installed in the
  46. <filename>/lib</filename> and <filename>/usr/lib</filename> directories.
  47. To honor those packages, create two symlinks:</para>
  48. <para><screen><userinput>ln -s ../usr/bin/cpp /lib</userinput></screen></para>
  49. <para>Many packages compile using <emphasis>cc</emphasis> as the name for
  50. the C compiler. To satisfy those packages, create a <emphasis>cc</emphasis>
  51. symlink:</para>
  52. <para><screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen></para>
  53. <para><screen><userinput>rm /usr/lib/libiberty.a</userinput></screen></para>
  54. </sect2>