libstdc++.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?xml version="1.0" encoding="UTF-8"?>
  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-libstdcpp" role="wrap">
  8. <?dbhtml filename="gcc-libstdc++.html"?>
  9. <sect1info condition="script">
  10. <productname>gcc-libstdc++</productname>
  11. <productnumber>&gcc-version;</productnumber>
  12. <address>&gcc-url;</address>
  13. </sect1info>
  14. <title>GCC-&gcc-version; 中的 Libstdc++</title>
  15. <indexterm zone="ch-tools-libstdcpp">
  16. <primary sortas="a-GCC">GCC</primary>
  17. <secondary>tools, libstdc++</secondary>
  18. </indexterm>
  19. <sect2 role="package">
  20. <title/>
  21. <!--para>Libstdc++ is the standard C++ library. It is needed
  22. to compile C++ code
  23. (part of GCC is written in C++), but we had to defer its installation
  24. when we built <xref linkend="ch-tools-gcc-pass1"/>
  25. because it depends on glibc, which was not yet available in /tools.
  26. </para-->
  27. <para>Libstdc++ 是 C++ 标准库,我们需要它才能编译 C++ 代码
  28. (GCC 的一部分用 C++ 编写)。但在构建
  29. <xref linkend="ch-tools-gcc-pass1"/> 时我们不得不暂缓安装它,
  30. 因为它依赖于当时还没有安装到 /tools 的 glibc。</para>
  31. <segmentedlist>
  32. <segtitle>&buildtime;</segtitle>
  33. <segtitle>&diskspace;</segtitle>
  34. <seglistitem>
  35. <seg>&libstdcpp-ch5-sbu;</seg>
  36. <seg>&libstdcpp-ch5-du;</seg>
  37. </seglistitem>
  38. </segmentedlist>
  39. </sect2>
  40. <sect2 role="installation">
  41. <title>安装目标系统的 Libstdc++</title>
  42. <note>
  43. <!--para><application>Libstdc++</application> is part of the GCC sources.
  44. You should first unpack the GCC tarball and change to the
  45. <filename>gcc-&gcc-version;</filename> directory.</para-->
  46. <para><application>Libstdc++</application> 是 GCC 源代码的一部分。
  47. 您应该先解压 GCC 源码包并切换到解压出来的
  48. <filename>gcc-&gcc-version;</filename> 目录。</para>
  49. </note>
  50. <!--para>Create a separate build directory for Libstdc++ and enter it:</para-->
  51. <para>为 Libstdc++ 创建一个单独的构建目录,并进入它:</para>
  52. <screen><userinput remap="pre">mkdir -v build
  53. cd build</userinput></screen>
  54. <para>准备编译 Libstdc++:</para>
  55. <screen><userinput remap="configure">../libstdc++-v3/configure \
  56. --host=$LFS_TGT \
  57. --prefix=/tools \
  58. --disable-multilib \
  59. --disable-nls \
  60. --disable-libstdcxx-threads \
  61. --disable-libstdcxx-pch \
  62. --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen>
  63. <variablelist>
  64. <title>配置选项的含义:</title>
  65. <varlistentry>
  66. <term><parameter>--host=...</parameter></term>
  67. <listitem>
  68. <!--para>Indicates to use the cross compiler we have just built
  69. instead of the one in <filename>/usr/bin</filename>.</para-->
  70. <para>使用我们刚刚编译的交叉编译器,而不是
  71. <filename>/usr/bin</filename> 中的宿主系统编译器。</para>
  72. </listitem>
  73. </varlistentry>
  74. <varlistentry>
  75. <term><parameter>--disable-libstdcxx-threads</parameter></term>
  76. <listitem>
  77. <!--para>Since we have not yet built the C threads library, the C++
  78. one cannot be built either.</para-->
  79. <para>由于我们目前还没有构建 C 线程库,C++ 线程库也不能构建。
  80. </para>
  81. </listitem>
  82. </varlistentry>
  83. <varlistentry>
  84. <term><parameter>--disable-libstdcxx-pch</parameter></term>
  85. <listitem>
  86. <!--para>This switch prevents the installation of precompiled
  87. include files, which are not needed at this stage.</para-->
  88. <para>这个开关防止安装预编译头文件,在这个阶段不需要它们。</para>
  89. </listitem>
  90. </varlistentry>
  91. <varlistentry>
  92. <term><parameter>--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</parameter></term>
  93. <listitem>
  94. <!--para>This is the location where the standard include files are
  95. searched by the C++ compiler. In a normal build, this information
  96. is automatically passed to the Libstdc++ <command>configure</command>
  97. options from the top level directory. In our case, this information
  98. must be explicitly given.</para-->
  99. <para>这是 C++ 编译器搜索标准头文件的位置。在正常的构建过程中,
  100. 这项信息被顶层目录构建系统自动传递给 Libstdc++
  101. <command>configure</command> 脚本。
  102. 然而我们这里没有使用顶层构建系统,因此必须明确给出这项信息。
  103. </para>
  104. </listitem>
  105. </varlistentry>
  106. </variablelist>
  107. <para>运行以下命令编译 Libstdc++:</para>
  108. <screen><userinput remap="make">make</userinput></screen>
  109. <para>安装这个库:</para>
  110. <screen><userinput remap="install">make install</userinput></screen>
  111. </sect2>
  112. <sect2 role="content">
  113. <title/>
  114. <para>关于该软件包的详细信息可以在
  115. <xref linkend="contents-gcc"/> 中找到。</para>
  116. </sect2>
  117. </sect1>