|
@@ -1,4 +1,4 @@
|
|
-<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
|
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
|
@@ -14,7 +14,7 @@
|
|
<address>&binutils-url;</address>
|
|
<address>&binutils-url;</address>
|
|
</sect1info>
|
|
</sect1info>
|
|
|
|
|
|
- <title>Binutils-&binutils-version; - Pass 2</title>
|
|
|
|
|
|
+ <title>Binutils-&binutils-version; - 第二遍</title>
|
|
|
|
|
|
<indexterm zone="ch-tools-binutils-pass2">
|
|
<indexterm zone="ch-tools-binutils-pass2">
|
|
<primary sortas="a-Binutils">Binutils</primary>
|
|
<primary sortas="a-Binutils">Binutils</primary>
|
|
@@ -41,14 +41,14 @@
|
|
</sect2>
|
|
</sect2>
|
|
|
|
|
|
<sect2 role="installation">
|
|
<sect2 role="installation">
|
|
- <title>Installation of Binutils</title>
|
|
|
|
|
|
+ <title>安装 Binutils</title>
|
|
|
|
|
|
- <para>Create a separate build directory again:</para>
|
|
|
|
|
|
+ <para>再一次地,创建一个单独的构建目录:</para>
|
|
|
|
|
|
<screen><userinput remap="pre">mkdir -v build
|
|
<screen><userinput remap="pre">mkdir -v build
|
|
cd build</userinput></screen>
|
|
cd build</userinput></screen>
|
|
|
|
|
|
- <para>Prepare Binutils for compilation:</para>
|
|
|
|
|
|
+ <para>准备安装 Binutils:</para>
|
|
|
|
|
|
<screen><userinput remap="configure">CC=$LFS_TGT-gcc \
|
|
<screen><userinput remap="configure">CC=$LFS_TGT-gcc \
|
|
AR=$LFS_TGT-ar \
|
|
AR=$LFS_TGT-ar \
|
|
@@ -61,77 +61,118 @@ RANLIB=$LFS_TGT-ranlib \
|
|
--with-sysroot</userinput></screen>
|
|
--with-sysroot</userinput></screen>
|
|
|
|
|
|
<variablelist>
|
|
<variablelist>
|
|
- <title>The meaning of the new configure options:</title>
|
|
|
|
|
|
+ <title>配置选项的含义:</title>
|
|
|
|
|
|
<varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</parameter></term>
|
|
<term><parameter>CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</parameter></term>
|
|
<listitem>
|
|
<listitem>
|
|
- <para>Because this is really a native build of Binutils, setting these
|
|
|
|
|
|
+ <!--para>Because this is really a native build of Binutils, setting these
|
|
variables ensures that the build system uses the cross-compiler and
|
|
variables ensures that the build system uses the cross-compiler and
|
|
- associated tools instead of the ones on the host system.</para>
|
|
|
|
|
|
+ associated tools instead of the ones on the host system.</para-->
|
|
|
|
+ <para>这次编译 Binutils 是本地编译而不是交叉编译,
|
|
|
|
+ 设置这些变量可以强制构建系统使用交叉编译器和相关工具,
|
|
|
|
+ 而不是宿主系统的编译器和工具。</para>
|
|
</listitem>
|
|
</listitem>
|
|
</varlistentry>
|
|
</varlistentry>
|
|
|
|
|
|
<varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>--with-lib-path=/tools/lib</parameter></term>
|
|
<term><parameter>--with-lib-path=/tools/lib</parameter></term>
|
|
<listitem>
|
|
<listitem>
|
|
- <para>This tells the configure script to specify the library
|
|
|
|
|
|
+ <!--para>This tells the configure script to specify the library
|
|
search path during the compilation of Binutils, resulting in
|
|
search path during the compilation of Binutils, resulting in
|
|
<filename class="directory">/tools/lib</filename> being passed
|
|
<filename class="directory">/tools/lib</filename> being passed
|
|
to the linker. This prevents the linker from searching through
|
|
to the linker. This prevents the linker from searching through
|
|
- library directories on the host.</para>
|
|
|
|
|
|
+ library directories on the host.</para-->
|
|
|
|
+ <para>这个选项使得配置脚本在编译 Binutils 时指定库文件搜索目录,
|
|
|
|
+ 将 <filename class="directory">/tools/lib</filename>
|
|
|
|
+ 传递给链接器。这保证链接器不会搜索宿主系统的库文件目录。
|
|
|
|
+ </para>
|
|
</listitem>
|
|
</listitem>
|
|
</varlistentry>
|
|
</varlistentry>
|
|
|
|
|
|
<varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>--with-sysroot</parameter></term>
|
|
<term><parameter>--with-sysroot</parameter></term>
|
|
<listitem>
|
|
<listitem>
|
|
- <para>The sysroot feature enables the linker to find shared objects
|
|
|
|
|
|
+ <!--para>The sysroot feature enables the linker to find shared objects
|
|
which are required by other shared objects explicitly included on the
|
|
which are required by other shared objects explicitly included on the
|
|
linker's command line. Without this, some packages may not build
|
|
linker's command line. Without this, some packages may not build
|
|
- successfully on some hosts.</para>
|
|
|
|
|
|
+ successfully on some hosts.</para-->
|
|
|
|
+ <para>在链接时,某些共享对象可能要求其他共享对象,sysroot
|
|
|
|
+ 特性允许链接器查找它们。如果不启用它,在某些宿主环境中,
|
|
|
|
+ 一些软件包无法成功构建。</para>
|
|
|
|
+ <note><title>译注</title>
|
|
|
|
+ <para>这个选项看上去很奇怪,而且解释不够清晰。
|
|
|
|
+ 译者查资料得知,
|
|
|
|
+ 从 Binutils 2.17 起,为保证和动态链接器的一致性,
|
|
|
|
+ <command>ld</command>在搜索 DT_NEEDED
|
|
|
|
+ 要求的共享对象时,先搜索
|
|
|
|
+ <filename>/etc/ld.so.conf</filename> 指定的目录,
|
|
|
|
+ 再搜索配置时指定的默认目录。如果不启用 sysroot 功能,
|
|
|
|
+ 且宿主系统使用了 <filename>/etc/ld.so.conf</filename>,
|
|
|
|
+ 那么宿主环境中的共享对象会污染工具链,
|
|
|
|
+ 进而导致一系列严重问题。
|
|
|
|
+ 如果您不想使用这个看上去奇怪的选项,可以执行
|
|
|
|
+ <userinput>touch /tools/etc/ld.so.conf</userinput>
|
|
|
|
+ 创建一个空的 <filename>ld.so.conf</filename> 文件,
|
|
|
|
+ 覆盖宿主系统的设置。参阅
|
|
|
|
+ <ulink url="http://lists.linuxfromscratch.org/pipermail/lfs-dev/2012-December/067457.html">lfs-dev 列表中的讨论</ulink>,以及
|
|
|
|
+ <ulink url="https://sourceware.org/bugzilla/show_bug.cgi?id=2290">ld/2290</ulink>。
|
|
|
|
+ 另外 <filename>ld(1)</filename>
|
|
|
|
+ 中关于这个搜索顺序的描述尚未更新。
|
|
|
|
+ </para>
|
|
|
|
+ </note>
|
|
</listitem>
|
|
</listitem>
|
|
</varlistentry>
|
|
</varlistentry>
|
|
|
|
|
|
</variablelist>
|
|
</variablelist>
|
|
|
|
|
|
- <para>Compile the package:</para>
|
|
|
|
|
|
+ <para>编译该软件包:</para>
|
|
|
|
|
|
<screen><userinput remap="make">make</userinput></screen>
|
|
<screen><userinput remap="make">make</userinput></screen>
|
|
|
|
|
|
- <para>Install the package:</para>
|
|
|
|
|
|
+ <para>安装该软件包:</para>
|
|
|
|
|
|
<screen><userinput remap="install">make install</userinput></screen>
|
|
<screen><userinput remap="install">make install</userinput></screen>
|
|
|
|
|
|
- <para>Now prepare the linker for the <quote>Re-adjusting</quote> phase in
|
|
|
|
- the next chapter:</para>
|
|
|
|
|
|
+ <!--para>Now prepare the linker for the <quote>Re-adjusting</quote> phase in
|
|
|
|
+ the next chapter:</para-->
|
|
|
|
+<para>现在,为下一章的 <quote>重新调整</quote> 阶段准备链接器:</para>
|
|
|
|
|
|
<screen><userinput remap="adjust">make -C ld clean
|
|
<screen><userinput remap="adjust">make -C ld clean
|
|
make -C ld LIB_PATH=/usr/lib:/lib
|
|
make -C ld LIB_PATH=/usr/lib:/lib
|
|
cp -v ld/ld-new /tools/bin</userinput></screen>
|
|
cp -v ld/ld-new /tools/bin</userinput></screen>
|
|
|
|
|
|
<variablelist>
|
|
<variablelist>
|
|
- <title>The meaning of the make parameters:</title>
|
|
|
|
|
|
+ <title>make 命令参数的含义:</title>
|
|
|
|
|
|
<varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>-C ld clean</parameter></term>
|
|
<term><parameter>-C ld clean</parameter></term>
|
|
<listitem>
|
|
<listitem>
|
|
- <para>This tells the make program to remove all compiled
|
|
|
|
|
|
+ <!--para>This tells the make program to remove all compiled
|
|
files in the <filename class="directory">ld</filename>
|
|
files in the <filename class="directory">ld</filename>
|
|
- subdirectory.</para>
|
|
|
|
|
|
+ subdirectory.</para-->
|
|
|
|
+ <para>该选项告诉 make 程序移除
|
|
|
|
+ <filename class="directory">ld</filename>
|
|
|
|
+ 子目录中所有编译得到的文件。</para>
|
|
</listitem>
|
|
</listitem>
|
|
</varlistentry>
|
|
</varlistentry>
|
|
|
|
|
|
<varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>-C ld LIB_PATH=/usr/lib:/lib</parameter></term>
|
|
<term><parameter>-C ld LIB_PATH=/usr/lib:/lib</parameter></term>
|
|
<listitem>
|
|
<listitem>
|
|
- <para>This option rebuilds everything in the <filename
|
|
|
|
|
|
+ <!--para>This option rebuilds everything in the <filename
|
|
class="directory">ld</filename> subdirectory. Specifying the
|
|
class="directory">ld</filename> subdirectory. Specifying the
|
|
<envar>LIB_PATH</envar> Makefile variable on the command line
|
|
<envar>LIB_PATH</envar> Makefile variable on the command line
|
|
allows us to override the default value of the temporary tools
|
|
allows us to override the default value of the temporary tools
|
|
and point it to the proper final path. The value of this variable
|
|
and point it to the proper final path. The value of this variable
|
|
specifies the linker's default library search path. This
|
|
specifies the linker's default library search path. This
|
|
- preparation is used in the next chapter.</para>
|
|
|
|
|
|
+ preparation is used in the next chapter.</para-->
|
|
|
|
+ <para>该选项重新构建 <filename class="directory">ld</filename>
|
|
|
|
+ 子目录中的一切。在命令行指定 <envar>LIB_PATH</envar>
|
|
|
|
+ Makefile 变量,即可覆盖临时工具的默认值,
|
|
|
|
+ 并将其指向正确的最终路径。
|
|
|
|
+ 该变量的值指定链接器的默认库文件搜索路径,
|
|
|
|
+ 这个准备好的链接器将在下一章使用。</para>
|
|
</listitem>
|
|
</listitem>
|
|
</varlistentry>
|
|
</varlistentry>
|
|
|
|
|
|
@@ -142,8 +183,8 @@ cp -v ld/ld-new /tools/bin</userinput></screen>
|
|
<sect2 role="content">
|
|
<sect2 role="content">
|
|
<title/>
|
|
<title/>
|
|
|
|
|
|
- <para>Details on this package are located in
|
|
|
|
- <xref linkend="contents-binutils" role="."/></para>
|
|
|
|
|
|
+ <para>该软件包的更多信息可以在
|
|
|
|
+ <xref linkend="contents-binutils"/> 中找到。</para>
|
|
|
|
|
|
</sect2>
|
|
</sect2>
|
|
|
|
|