gmp.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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-system-gmp" role="wrap">
  8. <?dbhtml filename="gmp.html"?>
  9. <sect1info condition="script">
  10. <productname>gmp</productname>
  11. <productnumber>&gmp-version;</productnumber>
  12. <address>&gmp-url;</address>
  13. </sect1info>
  14. <title>GMP-&gmp-version;</title>
  15. <indexterm zone="ch-system-gmp">
  16. <primary sortas="a-GMP">GMP</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <para>GMP 软件包包含提供任意精度算术函数的数学库。</para>
  21. <segmentedlist>
  22. <segtitle>&buildtime;</segtitle>
  23. <segtitle>&diskspace;</segtitle>
  24. <seglistitem>
  25. <seg>&gmp-ch6-sbu;</seg>
  26. <seg>&gmp-ch6-du;</seg>
  27. </seglistitem>
  28. </segmentedlist>
  29. </sect2>
  30. <sect2 role="installation">
  31. <title>安装 GMP</title>
  32. <note>
  33. <!--para>If you are building for 32-bit x86, but you have a CPU which is
  34. capable of running 64-bit code <emphasis>and</emphasis> you have specified
  35. <envar>CFLAGS</envar> in the environment, the configure script will
  36. attempt to configure for 64-bits and fail.
  37. Avoid this by invoking the configure command below with -->
  38. <para>如果您在为 32 位 x86 构建 LFS ,但您的 CPU 能够运行
  39. 64 位代码, <emphasis>而且</emphasis> 您指定了
  40. <envar>CFLAGS</envar> 环境变量,配置脚本会试图为 64 位 CPU
  41. 进行配置并且失败。为了避免这个问题,像下面这样执行 configure
  42. 命令:
  43. <screen role="nodump"><userinput><parameter>ABI=32</parameter> ./configure ...</userinput></screen></para>
  44. </note>
  45. <note>
  46. <!--para>The default settings of GMP produce libraries optimized for
  47. the host processor. If libraries suitable for processors less
  48. capable than the host's CPU are desired, generic libraries can be
  49. created by running the following:-->
  50. <para>GMP 的默认设定会生成为本机处理器优化的库。
  51. 如果您希望获得适合功能不如本机的 CPU 的库,
  52. 执行以下命令,以生成通用库:
  53. <screen role="nodump"><userinput>cp -v configfsf.guess config.guess
  54. cp -v configfsf.sub config.sub</userinput></screen></para>
  55. </note>
  56. <para>准备安装 GMP:</para>
  57. <screen><userinput remap="configure">./configure --prefix=/usr \
  58. --enable-cxx \
  59. --disable-static \
  60. --docdir=/usr/share/doc/gmp-&gmp-version;</userinput></screen>
  61. <variablelist>
  62. <title>新的配置选项的含义:</title>
  63. <varlistentry>
  64. <term><parameter>--enable-cxx</parameter></term>
  65. <listitem>
  66. <para>该参数启用 C++ 支持</para>
  67. </listitem>
  68. </varlistentry>
  69. <varlistentry>
  70. <term><parameter>--docdir=/usr/share/doc/gmp-&gmp-version;</parameter></term>
  71. <listitem>
  72. <para>该变量指定文档的正确位置</para>
  73. </listitem>
  74. </varlistentry>
  75. </variablelist>
  76. <para>编译该软件包,并生成 HTML 文档:</para>
  77. <screen><userinput remap="make">make
  78. make html</userinput></screen>
  79. <important>
  80. <para>本节中 GMP 的测试套件被认为是关键的,无论如何不能跳过。</para>
  81. </important>
  82. <para>测试编译结果:</para>
  83. <screen><userinput remap="test">make check 2>&amp;1 | tee gmp-check-log</userinput></screen>
  84. <caution><!--para>The code in gmp is highly optimized for the processor where
  85. it is built. Occasionally, the code that detects the processor misidentifies
  86. the system capabilities and there will be errors in the tests or other
  87. applications using the gmp libraries with the message "Illegal
  88. instruction". In this case, gmp should be reconfigured with the option
  89. build=x86_64-unknown-linux-gnu and rebuilt.</para-->
  90. <para>GMP 中的代码是针对本机处理器高度优化的。
  91. 在偶然情况下,检测处理器的代码会错误识别 CPU 的功能,
  92. 导致测试套件或使用 GMP 的其他程序输出消息
  93. <quote>Illegal instruction</quote> (非法指令)。
  94. 如果发生这种情况,需要加入选项
  95. --build=x86_64-unknown-linux-gnu 并重新构建 GMP 。</para>
  96. </caution>
  97. <!--para>Ensure that all 190 tests in the test suite passed.
  98. Check the results by issuing the following command:</para-->
  99. <para>务必确认测试套件中的全部 190 个测试都被通过。
  100. 运行以下命令检验结果:</para>
  101. <screen><userinput remap="test">awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log</userinput></screen>
  102. <para>安装该软件包和文档:</para>
  103. <screen><userinput remap="install">make install
  104. make install-html</userinput></screen>
  105. </sect2>
  106. <sect2 id="contents-gmp" role="content">
  107. <title>GMP 的内容</title>
  108. <segmentedlist>
  109. <segtitle>安装的库</segtitle>
  110. <segtitle>安装的目录</segtitle>
  111. <seglistitem>
  112. <seg>libgmp.so 和 libgmpxx.so</seg>
  113. <seg>/usr/share/doc/gmp-&gmp-version;</seg>
  114. </seglistitem>
  115. </segmentedlist>
  116. <variablelist>
  117. <bridgehead renderas="sect3">简要描述</bridgehead>
  118. <?dbfo list-presentation="list"?>
  119. <?dbhtml list-presentation="table"?>
  120. <varlistentry id="libgmp">
  121. <term><filename class="libraryfile">libgmp</filename></term>
  122. <listitem>
  123. <para>包含任意精度数学函数</para>
  124. <indexterm zone="ch-system-gmp libgmp">
  125. <primary sortas="c-libgmp">libgmp</primary>
  126. </indexterm>
  127. </listitem>
  128. </varlistentry>
  129. <varlistentry id="libgmpxx">
  130. <term><filename class="libraryfile">libgmpxx</filename></term>
  131. <listitem>
  132. <para>包含 C++ 任意精度数学函数</para>
  133. <indexterm zone="ch-system-gmp libgmpxx">
  134. <primary sortas="c-libgmpxx">libgmpxx</primary>
  135. </indexterm>
  136. </listitem>
  137. </varlistentry>
  138. </variablelist>
  139. </sect2>
  140. </sect1>