| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 | <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [  <!ENTITY % general-entities SYSTEM "../general.ent">  %general-entities;]><sect1 id="ch-tools-libstdcpp" role="wrap">  <?dbhtml filename="gcc-libstdc++.html"?>  <sect1info condition="script">    <productname>gcc</productname>    <productnumber>&gcc-version;</productnumber>    <address>&gcc-url;</address>  </sect1info>  <title>GCC-&gcc-version; 中的 Libstdc++</title>  <indexterm zone="ch-tools-libstdcpp">    <primary sortas="a-GCC">GCC</primary>    <secondary>tools, libstdc++</secondary>  </indexterm>  <sect2 role="package">    <title/>    <!--para>Libstdc++ is the standard C++ library. It is needed     to compile C++ code    (part of GCC is written in C++), but we had to defer its installation    when we built <xref linkend="ch-tools-gcc-pass1"/>    because it depends on glibc, which was not yet available in /tools.    </para-->	<para>Libstdc++ 是 C++ 标准库,我们需要它才能编译 C++ 代码    (GCC 的一部分用 C++ 编写)。但在构建	<xref linkend="ch-tools-gcc-pass1"/> 时我们不得不暂缓安装它,	因为它依赖于当时还没有安装到 /tools 的 glibc。</para>    <segmentedlist>      <segtitle>&buildtime;</segtitle>      <segtitle>&diskspace;</segtitle>      <seglistitem>        <seg>&libstdcpp-ch5-sbu;</seg>        <seg>&libstdcpp-ch5-du;</seg>      </seglistitem>    </segmentedlist>  </sect2>  <sect2 role="installation">    <title>安装目标系统的 Libstdc++</title>    <note>      <!--para><application>Libstdc++</application> is part of the GCC sources.      You should first unpack the GCC tarball and change to the      <filename>gcc-&gcc-version;</filename> directory.</para-->      <para><application>Libstdc++</application> 是 GCC 源代码的一部分。		  您应该先解压 GCC 源码包并切换到解压出来的		  <filename>gcc-&gcc-version;</filename> 目录。</para>    </note>    <!--para>Create a separate build directory for Libstdc++ and enter it:</para-->    <para>为 Libstdc++ 创建一个单独的构建目录,并进入它:</para><screen><userinput remap="pre">mkdir -v buildcd       build</userinput></screen>    <para>准备编译 Libstdc++:</para><screen><userinput remap="configure">../libstdc++-v3/configure           \    --host=$LFS_TGT                 \    --prefix=/tools                 \    --disable-multilib              \    --disable-nls                   \    --disable-libstdcxx-threads     \    --disable-libstdcxx-pch         \    --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen>    <variablelist>      <title>配置选项的含义:</title>      <varlistentry>        <term><parameter>--host=...</parameter></term>        <listitem>          <!--para>Indicates to use the cross compiler we have just built          instead of the one in <filename>/usr/bin</filename>.</para-->	      <para>使用我们刚刚编译的交叉编译器,而不是			  <filename>/usr/bin</filename> 中的宿主系统编译器。</para>        </listitem>      </varlistentry>      <varlistentry>        <term><parameter>--disable-libstdcxx-threads</parameter></term>        <listitem>          <!--para>Since we have not yet built the C threads library, the C++          one cannot be built either.</para-->	      <para>由于我们目前还没有构建 C 线程库,C++ 线程库也不能构建。		  </para>        </listitem>      </varlistentry>      <varlistentry>        <term><parameter>--disable-libstdcxx-pch</parameter></term>        <listitem>          <!--para>This switch prevents the installation of precompiled          include files, which are not needed at this stage.</para-->          <para>这个开关防止安装预编译头文件,在这个阶段不需要它们。</para>        </listitem>      </varlistentry>      <varlistentry>        <term><parameter>--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</parameter></term>        <listitem>          <!--para>This is the location where the standard include files are          searched by the C++ compiler. In a normal build, this information          is automatically passed to the Libstdc++ <command>configure</command>          options from the top level directory. In our case, this information          must be explicitly given.</para-->          <para>这是 C++ 编译器搜索标准头文件的位置。在正常的构建过程中,			  这项信息被顶层目录构建系统自动传递给 Libstdc++			  <command>configure</command> 脚本。			  然而我们这里没有使用顶层构建系统,因此必须明确给出这项信息。		  </para>        </listitem>      </varlistentry>    </variablelist>    <para>运行以下命令编译 Libstdc++:</para><screen><userinput remap="make">make</userinput></screen>    <para>安装这个库:</para><screen><userinput remap="install">make install</userinput></screen>  </sect2>  <sect2 role="content">    <title/>    <para>关于该软件包的详细信息可以在		<xref linkend="contents-gcc"/> 中找到。</para>  </sect2></sect1>
 |