binutils-pass1.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-tools-binutils-pass1" role="wrap">
  8. <?dbhtml filename="binutils-pass1.html"?>
  9. <sect1info condition="script">
  10. <productname>binutils-pass1</productname>
  11. <productnumber>&binutils-version;</productnumber>
  12. <address>&binutils-url;</address>
  13. </sect1info>
  14. <title>Binutils-&binutils-version; - Pass 1</title>
  15. <indexterm zone="ch-tools-binutils-pass1">
  16. <primary sortas="a-Binutils">Binutils</primary>
  17. <secondary>tools, pass 1</secondary>
  18. </indexterm>
  19. <sect2 role="package">
  20. <title/>
  21. <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
  22. href="../chapter06/binutils.xml"
  23. xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
  24. <segmentedlist>
  25. <segtitle>&buildtime;</segtitle>
  26. <segtitle>&diskspace;</segtitle>
  27. <seglistitem>
  28. <seg>&binutils-ch5p1-sbu;</seg>
  29. <seg>&binutils-ch5p1-du;</seg>
  30. </seglistitem>
  31. </segmentedlist>
  32. </sect2>
  33. <sect2 role="installation">
  34. <title>Installation of Cross Binutils</title>
  35. <note><para>Go back and re-read the notes in the previous section.
  36. Understanding the notes labeled important will save you a lot
  37. of problems later.</para></note>
  38. <para>It is important that Binutils be the first package compiled
  39. because both Glibc and GCC perform various tests on the available
  40. linker and assembler to determine which of their own features to
  41. enable.</para>
  42. <para>The Binutils documentation recommends building Binutils
  43. in a dedicated build directory:</para>
  44. <screen><userinput remap="pre">mkdir -v build
  45. cd build</userinput></screen>
  46. <note>
  47. <para>In order for the SBU values listed in the rest of the book
  48. to be of any use, measure the time it takes to build this package from
  49. the configuration, up to and including the first install. To achieve
  50. this easily, wrap the commands in a <command>time</command>
  51. command like this: <userinput>time { ./configure ... &amp;&amp; ...
  52. &amp;&amp; make install; }</userinput>.</para>
  53. </note>
  54. <note><para>The approximate build SBU values and required disk space
  55. in Chapter&nbsp;5 does not include test suite data.</para></note>
  56. <para>Now prepare Binutils for compilation:</para>
  57. <screen arch="default"><userinput remap="configure">../configure --prefix=/tools \
  58. --with-sysroot=$LFS \
  59. --with-lib-path=/tools/lib \
  60. --target=$LFS_TGT \
  61. --disable-nls \
  62. --disable-werror</userinput></screen>
  63. <screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">lpath=/tools/lib</userinput>
  64. <userinput remap="configure" arch="ml_32,ml_all">lpath="$lpath:/tools/lib32"</userinput>
  65. <userinput remap="configure" arch="ml_x32,ml_all">lpath="$lpath:/tools/libx32"</userinput>
  66. <userinput remap="configure">../configure --prefix=/tools \
  67. --with-sysroot=$LFS \
  68. --with-lib-path=$lpath \
  69. --target=$LFS_TGT \
  70. --disable-nls \
  71. --disable-werror \
  72. --enable-64-bit-bfd \
  73. --enable-multilib</userinput></screen>
  74. <variablelist>
  75. <title>The meaning of the configure options:</title>
  76. <varlistentry>
  77. <term><parameter>--prefix=/tools</parameter></term>
  78. <listitem>
  79. <para>This tells the configure script to prepare to install the
  80. Binutils programs in the <filename class="directory">/tools</filename>
  81. directory.</para>
  82. </listitem>
  83. </varlistentry>
  84. <varlistentry>
  85. <term><parameter>--with-sysroot=$LFS</parameter></term>
  86. <listitem>
  87. <para>For cross compilation, this tells the build system to look in
  88. $LFS for the target system libraries as needed.</para>
  89. </listitem>
  90. </varlistentry>
  91. <varlistentry>
  92. <term><parameter>--with-lib-path=/tools/lib</parameter></term>
  93. <listitem>
  94. <para>This specifies which library path the linker should be
  95. configured to use.</para>
  96. </listitem>
  97. </varlistentry>
  98. <varlistentry>
  99. <term><envar>--target=$LFS_TGT</envar></term>
  100. <listitem>
  101. <para>Because the machine description in the <envar>LFS_TGT</envar>
  102. variable is slightly different than the value returned by the
  103. <command>config.guess</command> script, this switch will tell the
  104. <command>configure</command> script to adjust Binutil's build system
  105. for building a cross linker. </para>
  106. </listitem>
  107. </varlistentry>
  108. <varlistentry>
  109. <term><parameter>--disable-nls</parameter></term>
  110. <listitem>
  111. <para>This disables internationalization as i18n is not needed for the
  112. temporary tools.</para>
  113. </listitem>
  114. </varlistentry>
  115. <varlistentry>
  116. <term><parameter>--disable-werror</parameter></term>
  117. <listitem>
  118. <para>This prevents the build from stopping in the event that there
  119. are warnings from the host's compiler.</para>
  120. </listitem>
  121. </varlistentry>
  122. </variablelist>
  123. <para>Continue with compiling the package:</para>
  124. <screen><userinput remap="make">make</userinput></screen>
  125. <para>Compilation is now complete. Ordinarily we would now run the
  126. test suite, but at this early stage the test suite framework (Tcl,
  127. Expect, and DejaGNU) is not yet in place. The benefits of running the
  128. tests at this point are minimal since the programs from this
  129. first pass will soon be replaced by those from the second.</para>
  130. <para arch="default">If building on x86_64, create a symlink to ensure the
  131. sanity of the toolchain:</para>
  132. <para arch="ml_32,ml_x32,ml_all">Create a symlink to ensure the sanity of
  133. the toolchain:</para>
  134. <screen arch="default"><userinput remap="install">case $(uname -m) in
  135. x86_64) mkdir -v /tools/lib &amp;&amp; ln -sv lib /tools/lib64 ;;
  136. esac</userinput></screen>
  137. <screen arch="ml_32,ml_x32,ml_all"><userinput remap="install">mkdir -v /tools/lib &amp;&amp;
  138. ln -sv lib /tools/lib64</userinput></screen>
  139. <para>Install the package:</para>
  140. <screen><userinput remap="install">make install</userinput></screen>
  141. </sect2>
  142. <sect2 role="content">
  143. <title/>
  144. <para>Details on this package are located in
  145. <xref linkend="contents-binutils" role="."/></para>
  146. </sect2>
  147. </sect1>