libffi.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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-libffi" role="wrap">
  8. <?dbhtml filename="libffi.html"?>
  9. <sect1info condition="script">
  10. <productname>libffi</productname>
  11. <productnumber>&libffi-version;</productnumber>
  12. <address>&libffi-url;</address>
  13. </sect1info>
  14. <title>Libffi-&libffi-version;</title>
  15. <indexterm zone="ch-system-libffi">
  16. <primary sortas="a-libffi">libffi</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <para>Libffi 库提供一个可移植的高级编程接口,用于处理不同调用惯例。
  21. 这允许程序在运行时调用任何给定了调用接口的函数。</para>
  22. <segmentedlist>
  23. <segtitle>&buildtime;</segtitle>
  24. <segtitle>&diskspace;</segtitle>
  25. <seglistitem>
  26. <seg>&libffi-ch6-sbu;</seg>
  27. <seg>&libffi-ch6-du;</seg>
  28. </seglistitem>
  29. </segmentedlist>
  30. </sect2>
  31. <sect2 role="installation">
  32. <title>安装 Libffi</title>
  33. <note>
  34. <para>和 GMP 类似,libffi 在构建时会使用特定于当前处理器的优化。
  35. 如果是在为另一台计算机构建系统,请导出 CFLAGS 和 CXXFLAGS 环境变量,
  36. 为您的架构指定较为通用的构建目标。否则,所有链接到 libffi
  37. 的程序都可能触发非法指令异常。</para>
  38. </note>
  39. <para>修改 Makefile ,将头文件安装到标准的
  40. <filename class="directory">/usr/include</filename> 目录,而不是
  41. <filename class="directory">/usr/lib/libffi-&libffi-version;/include</filename>。</para>
  42. <screen><userinput remap="pre">sed -e '/^includesdir/ s/$(libdir).*$/$(includedir)/' \
  43. -i include/Makefile.in
  44. sed -e '/^includedir/ s/=.*$/=@includedir@/' \
  45. -e 's/^Cflags: -I${includedir}/Cflags:/' \
  46. -i libffi.pc.in</userinput></screen>
  47. <para>准备安装 libffi:</para>
  48. <screen><userinput remap="configure">./configure --prefix=/usr --disable-static --with-gcc-arch=native</userinput></screen>
  49. <variablelist>
  50. <title>The meaning of the configure option:</title>
  51. <varlistentry>
  52. <term><parameter>--with-gcc-arch=native</parameter></term>
  53. <listitem>
  54. <!--para>Ensure gcc optimizes for the current system. If this
  55. is not specified, the system is guessed and the code generated
  56. may not be correct for some systems. If the generated code
  57. will be copied from the native system to a less capable
  58. system, use the less capable system as a parameter. For details
  59. about alternative system types, see <ulink
  60. url='https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/x86-Options.html'>
  61. the x86 options in the gcc manual</ulink>.</para-->
  62. <para>保证 gcc 为当前系统进行优化。如果不使用该选项,
  63. 构建系统会猜测系统架构,在某些系统上可能生成不正确的代码。
  64. 如果要将生成的代码从本地系统复制到指令集功能较弱的系统中,
  65. 需要使用目标系统架构作为该选项的参数值,参阅
  66. <ulink
  67. url='https://gcc.gnu.org/onlinedocs/gcc-&gcc-version;/gcc/x86-Options.html'>
  68. gcc 手册中提供的的 x86 选项</ulink>。</para>
  69. </listitem>
  70. </varlistentry>
  71. </variablelist>
  72. <para>编译该软件包:</para>
  73. <screen><userinput remap="make">make</userinput></screen>
  74. <para>运行以下命令以测试编译结果:</para>
  75. <screen><userinput remap="test">make check</userinput></screen>
  76. <para>安装该软件包:</para>
  77. <screen><userinput remap="install">make install</userinput></screen>
  78. </sect2>
  79. <sect2 id="contents-libffi" role="content">
  80. <title>Libffi 的内容</title>
  81. <segmentedlist>
  82. <segtitle>安装的库</segtitle>
  83. <seglistitem>
  84. <seg>libffi.so</seg>
  85. </seglistitem>
  86. </segmentedlist>
  87. <variablelist>
  88. <bridgehead renderas="sect3">简要描述</bridgehead>
  89. <?dbfo list-presentation="list"?>
  90. <?dbhtml list-presentation="table"?>
  91. <varlistentry id="libffi">
  92. <term><filename class="libraryfile">libffi</filename></term>
  93. <listitem>
  94. <para>包含 libffi API 函数</para>
  95. <indexterm zone="ch-system-libffi">
  96. <primary sortas="c-libffi">libffi</primary>
  97. </indexterm>
  98. </listitem>
  99. </varlistentry>
  100. </variablelist>
  101. </sect2>
  102. </sect1>