gcc-inst.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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>It is recommended by the GCC installation documentation to build GCC
  14. in a dedicated directory outside of the source tree. Create the build
  15. directory:</para>
  16. <para><screen><userinput>mkdir ../gcc-build &amp;&amp;
  17. cd ../gcc-build</userinput></screen></para>
  18. <para>Prepare GCC to be compiled:</para>
  19. <para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr --enable-shared \
  20. &nbsp;&nbsp;&nbsp;&nbsp;--enable-threads=posix --with-slibdir=/lib \
  21. &nbsp;&nbsp;&nbsp;&nbsp;--enable-__cxa_atexit --enable-clocale=gnu</userinput></screen></para>
  22. <para>The meanings of the configure options are:</para>
  23. <itemizedlist>
  24. <listitem><para><userinput>--enable-threads=posix:</userinput> This enables
  25. C++ exception handling for multi-threaded code.</para></listitem>
  26. <listitem><para><userinput>--enable-__cxa_atexit:</userinput> This option
  27. will result in C++ shared libraries and C++ programs that are interoperable
  28. with other Linux distributions.</para></listitem>
  29. <listitem><para><userinput>--enable-clocale=gnu:</userinput> There is a risk
  30. that some people will build ABI incompatible C++ libraries if they didn't
  31. install all of the glibc localedata. Using --enable-clocale=gnu ensures that
  32. the "right thing" is done in all cases. If you don't wish to use this option,
  33. then at least build the <emphasis>de_DE</emphasis> locale. When GCC finds
  34. this specific locale, then the correct locale mode (<emphasis>gnu</emphasis>)
  35. is implemented.</para></listitem>
  36. </itemizedlist>
  37. <para>Continue with compiling the package:</para>
  38. <para><screen><userinput>make bootstrap</userinput></screen></para>
  39. <para>The <emphasis>bootstrap</emphasis> target doesn't just compile GCC, but
  40. it compiles GCC multiple times. It uses the first compiled programs to
  41. compile itself a second and third time to make sure the compiler was compiled
  42. properly.</para>
  43. <para>Finish installing the package:</para>
  44. <para><screen><userinput>make install-no-fixedincludes</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 &amp;&amp;
  49. ln -s ../bin/cpp /usr/lib</userinput></screen></para>
  50. <para>Many packages compile using <emphasis>cc</emphasis> as the name for
  51. the C compiler. To satisfy those packages, create a <emphasis>cc</emphasis>
  52. symlink:</para>
  53. <para><screen><userinput>ln -s gcc /usr/bin/cc</userinput></screen></para>
  54. </sect2>