binutils-pass1-inst.xml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
  2. <sect2>
  3. <title>Installation of Binutils</title>
  4. <para>It is important that Binutils be the first package to get compiled,
  5. because both Glibc and GCC perform various tests on the available linker and
  6. assembler to determine which of their own features to enable.</para>
  7. <note><para>Even though Binutils is an important toolchain package, we are not
  8. going to run the testsuite at this early stage. First, the testsuite framework
  9. is not yet in place and second, the programs from this first pass will soon be
  10. overwritten by those installed in the second pass.</para></note>
  11. <para>This package is known to behave badly when you have changed its default
  12. optimization flags (including the -march and -mcpu options). Therefore, if
  13. you have defined any environment variables that override default
  14. optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting or
  15. modifying them when building Binutils.</para>
  16. <para>It is recommended by the Binutils installation documentation to build
  17. Binutils outside of the source directory in a dedicated directory:</para>
  18. <para><screen><userinput>mkdir ../binutils-build
  19. cd ../binutils-build</userinput></screen></para>
  20. <para>Next, prepare Binutils to be compiled:</para>
  21. <para><screen><userinput>../binutils-&binutils-version;/configure \
  22. &nbsp;&nbsp;&nbsp;&nbsp;--prefix=/tools --disable-nls</userinput></screen></para>
  23. <para>The meaning of the configure switches:</para>
  24. <itemizedlist>
  25. <listitem><para><userinput>--prefix=/tools</userinput>: This tells the
  26. configure script to prepare to install the Binutils programs in the
  27. <filename>/tools</filename> directory.</para></listitem>
  28. <listitem><para><userinput>--disable-nls</userinput>: This disables
  29. internationalization (a word often shortened to i18n). We don't need this
  30. for our static programs and <emphasis>nls</emphasis> often causes problems
  31. when linking statically.</para></listitem>
  32. </itemizedlist>
  33. <para>Continue with compiling the package:</para>
  34. <para><screen><userinput>make configure-host
  35. make LDFLAGS="-all-static"</userinput></screen></para>
  36. <para>The meaning of the make option:</para>
  37. <itemizedlist>
  38. <listitem><para><userinput>LDFLAGS="-all-static"</userinput>: This tells
  39. the linker that all the Binutils programs should be linked
  40. statically.</para></listitem>
  41. </itemizedlist>
  42. <para>And install the package:</para>
  43. <para><screen><userinput>make install</userinput></screen></para>
  44. <para>Now prepare the linker for the "locking in" of Glibc later on:</para>
  45. <para><screen><userinput>make -C ld clean
  46. make -C ld LIB_PATH=/tools/lib</userinput></screen></para>
  47. <caution><para>Do not yet remove the Binutils build and source
  48. directories. You will need them again in their current state a bit further on
  49. in this chapter.</para></caution>
  50. </sect2>