libstdc++.xml 4.8 KB

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