12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079 |
- <?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-system-glibc" role="wrap">
- <?dbhtml filename="glibc.html"?>
- <sect1info condition="script">
- <productname>glibc</productname>
- <productnumber>&glibc-version;</productnumber>
- <address>&glibc-url;</address>
- </sect1info>
- <title>Glibc-&glibc-version;</title>
- <indexterm zone="ch-system-glibc">
- <primary sortas="a-Glibc">Glibc</primary>
- </indexterm>
- <sect2 role="package">
- <title/>
- <!--para>The Glibc package contains the main C library. This library provides
- the basic routines for allocating memory, searching directories, opening and
- closing files, reading and writing files, string handling, pattern matching,
- arithmetic, and so on.</para-->
- <para>Glibc 软件包包含主要的 C 语言库。它提供用于分配内存、检索目录、
- 打开和关闭文件、读写文件、字符串处理、模式匹配、
- 算术等用途的基本子程序。</para>
- <segmentedlist>
- <segtitle>&buildtime;</segtitle>
- <segtitle>&diskspace;</segtitle>
- <seglistitem>
- <seg>&glibc-ch6-sbu;</seg>
- <seg>&glibc-ch6-du;</seg>
- </seglistitem>
- </segmentedlist>
- </sect2>
- <sect2 role="installation">
- <title>安装 Glibc</title>
- <note><!--para>The Glibc build system is self-contained and will install
- perfectly, even though the compiler specs file and linker are still
- pointing to <filename class="directory">/tools</filename>. The specs
- and linker cannot be adjusted before the Glibc install because the
- Glibc autoconf tests would give false results and defeat the goal
- of achieving a clean build.</para-->
- <para> Glibc 构建系统是自给自足的,
- 即使编译器 specs 文件和链接器仍然指向
- <filename class="directory">/tools</filename>,
- 也能完美地安装 Glibc 。在安装 Glibc 之前不能调整工具链,
- 否则 Glibc 的 autoconf 测试会给出错误结果,
- 结果无法达成干净地构建 Glibc 这一目的。</para>
- </note>
- <!--para>Some of the Glibc programs use the non-FHS compilant
- <filename class="directory">/var/db</filename> directory to store
- their runtime data. Apply the following patch to make such programs
- store their runtime data in the FHS-compliant locations:</para-->
- <para>某些 Glibc 程序使用与 FHS 不兼容的
- <filename class="directory">/var/db</filename>
- 目录存放运行时数据。应用下列补丁,
- 使得这些程序在 FHS 兼容的位置存储运行时数据:</para>
- <screen><userinput remap="pre">patch -Np1 -i ../&glibc-fhs-patch;</userinput></screen>
- <!--
- <para>Fix a minor security issue with glob functions:</para>
- <screen><userinput remap="pre">patch -Np1 -i ../&glibc-glob-patch;</userinput></screen>
- -->
- <!--para>First create a compatibility symlink to avoid references to /tools in
- our final glibc:</para-->
- <para>创建一个与最终的 LFS 系统兼容的符号链接,
- 避免最终的 Glibc 包含对 /tools 的引用:
- </para>
- <screen><userinput remap="pre">ln -sfv /tools/lib/gcc /usr/lib</userinput></screen>
- <!--para>Determine the GCC include directory and create a symlink for LSB
- compliance. Additionally, for x86_64, create a compatibility symlink
- required for the dynamic loader to function correctly:</para-->
- <para>判定 GCC 包含文件目录,并为了兼容 LSB 创建一个符号链接。另外,
- 对于 x86_64 ,还要创建一个动态链接器的兼容性符号链接,
- 使它能够正常工作:</para>
- <screen><userinput remap="pre">case $(uname -m) in
- i?86) GCC_INCDIR=/usr/lib/gcc/$(uname -m)-pc-linux-gnu/&gcc-version;/include
- ln -sfv ld-linux.so.2 /lib/ld-lsb.so.3
- ;;
- x86_64) GCC_INCDIR=/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include
- ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64
- ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3
- ;;
- esac</userinput></screen>
- <!--para>Remove a file that may be left over from a previous build attempt:
- </para-->
- <para>删除上次编译时可能留下的文件:</para>
- <note><title>译注</title>
- <para>译者的惨痛教训表明,如果存在这个文件,
- 构建系统会无限循环。</para>
- </note>
- <screen><userinput remap="pre">rm -f /usr/include/limits.h</userinput></screen>
- <!--para>The Glibc documentation recommends building Glibc
- in a dedicated build directory:</para-->
- <para>Glibc 文档推荐在专用目录中构建它:</para>
- <screen><userinput remap="pre">mkdir -v build
- cd build</userinput></screen>
- <para>准备安装 Glibc:</para>
- <screen><userinput remap="configure">CC="gcc -isystem $GCC_INCDIR -isystem /usr/include" \
- ../configure --prefix=/usr \
- --disable-werror \
- --enable-kernel=&min-kernel; \
- --enable-stack-protector=strong \
- libc_cv_slibdir=/lib
- unset GCC_INCDIR</userinput></screen>
- <variablelist>
- <title>新的配置选项和参数的含义:</title>
- <varlistentry>
- <term><parameter>CC="gcc -isystem $GCC_INCDIR -isystem /usr/include"</parameter></term>
- <listitem>
- <!--para>Setting the location of both gcc and system include directories
- avoids introduction of invalid paths in debugging symbols.</para-->
- <para>设定 GCC 和系统的包含文件目录,避免调试符号中包含无效路径。
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>--disable-werror</parameter></term>
- <listitem>
- <!--para>This option disables the -Werror option passed to
- GCC. This is necessary for running the test suite.</para-->
- <para>该选项禁用 GCC 的 -Werror 选项,
- 这对于运行测试套件来说是必须的。</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>--enable-stack-protector=strong</parameter></term>
- <listitem>
- <!--para>This option increases system security by adding
- extra code to check for buffer overflows, such as stack
- smashing attacks.</para-->
- <para>该选项通过加入额外代码,
- 对栈溢出攻击等导致的缓冲区溢出进行检查,以提高系统安全性。
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>libc_cv_slibdir=/lib</parameter></term>
- <listitem>
- <para>这个变量纠正库文件安装位置,
- 我们不希望使用 lib64 目录。</para>
- </listitem>
- </varlistentry>
- </variablelist>
- <para>编译该软件包:</para>
- <screen><userinput remap="make">make</userinput></screen>
- <important>
- <!--para>In this section, the test suite for Glibc is considered critical.
- Do not skip it under any circumstance.</para-->
- <para>在本节中, Glibc 的测试套件十分关键,在任何情况下都不能跳过。
- </para>
- </important>
- <!--para>Generally a few tests do not pass. The test failures listed below
- are usually safe to ignore.</para-->
- <para>通常来说,可能会有极少数测试不能通过,
- 下面列出的失败结果一般可以安全地忽略。执行以下命令进行测试:
- </para>
- <screen><userinput remap="test">make check</userinput></screen>
- <!--para>You may see some test failures. The Glibc test suite is
- somewhat dependent on the host system. This is a list of the most common
- issues seen for some versions of LFS:</para-->
- <para>您可能看到一些失败结果。
- Glibc 的测试套件和宿主系统之间有某种依赖关系,以下是在一些版本的
- LFS 上最常见的问题:</para>
- <itemizedlist>
- <listitem>
- <para>已知 <emphasis>misc/tst-ttyname</emphasis>
- 在 LFS chroot 环境中会失败。</para>
- </listitem>
- <listitem>
- <para>已知 <emphasis>inet/tst-idna_name_classify</emphasis>
- 在 LFS chroot 环境中会失败。</para>
- </listitem>
- <listitem>
- <para>已知 <emphasis>posix/tst-getaddrinfo4</emphasis> 和
- <emphasis>posix/tst-getaddrinfo5</emphasis>
- 在某些硬件架构上会失败。</para>
- </listitem>
- <listitem>
- <para>已知 <emphasis>nss/tst-nss-files-hosts-multi</emphasis>
- 可能失败,原因尚未查明。</para>
- </listitem>
- <!--
- <listitem>
- <para>The <emphasis>rt/tst-cputimer1</emphasis> and
- <emphasis>rt/tst-cpuclock2</emphasis> tests have been known to
- fail. The reason is not completely understood, but indications are
- that minor timing issues can trigger these failures.</para>
- </listitem>
- -->
- <listitem>
- <para>如果 CPU 不是较新的 Intel 或 AMD 处理器,
- 数学测试有时会失败。</para>
- </listitem>
- <!--
- <listitem>
- <para>The
- <emphasis>nptl/tst-thread-affinity-{pthread,pthread2,sched}</emphasis>
- tests may fail for reasons that have not been determined. </para>
- </listitem>
- <listitem>
- <para>Other tests known to fail on some architectures are
- malloc/tst-malloc-usable and nptl/tst-cleanupx4. </para>
- </listitem>
- -->
- </itemizedlist>
- <!--para>Though it is a harmless message, the install stage of Glibc will
- complain about the absence of <filename>/etc/ld.so.conf</filename>.
- Prevent this warning with:</para-->
- <para>在安装 Glibc 时,它会抱怨文件 <filename>/etc/ld.so.conf</filename>
- 不存在。尽管这是一条无害的消息,执行以下命令即可防止这个警告:
- </para>
- <screen><userinput remap="install">touch /etc/ld.so.conf</userinput></screen>
- <!--para>Fix the generated Makefile to skip an unneeded sanity check
- that fails in the LFS partial environment:
- </para-->
- <para>修正生成的 Makefile ,
- 跳过一个在 LFS 的不完整环境中会失败的完整性检查:</para>
- <screen><userinput remap="install">sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile</userinput></screen>
- <para>安装该软件包:</para>
- <screen><userinput remap="install">make install</userinput></screen>
- <!--para>Install the configuration file and runtime directory for
- <command>nscd</command>:</para-->
- <para>安装 <command>nscd</command> 的配置文件和运行时目录:</para>
- <screen><userinput remap="install">cp -v ../nscd/nscd.conf /etc/nscd.conf
- mkdir -pv /var/cache/nscd</userinput></screen>
- <para revision="systemd">安装
- <command>nscd</command> 的 systemd 支持文件:</para>
- <screen revision="systemd"><userinput remap="install">install -v -Dm644 ../nscd/nscd.tmpfiles /usr/lib/tmpfiles.d/nscd.conf
- install -v -Dm644 ../nscd/nscd.service /lib/systemd/system/nscd.service</userinput></screen>
- <!--para>Next, install the locales that can make the system respond in a
- different language. None of the locales are required, but if some of them
- are missing, the test suites of future packages would skip important
- testcases.</para-->
- <para>下面,安装一些 locale ,它们可以使得系统用不同语言响应用户请求。
- 这些 locale 都不是必须的,但是如果缺少了它们中的某些,
- 在将来运行软件包的测试套件时,可能跳过重要的测试。</para>
- <!--para>Individual locales can be installed using the
- <command>localedef</command> program. E.g., the first
- <command>localedef</command> command below combines the
- <filename>/usr/share/i18n/locales/cs_CZ</filename>
- charset-independent locale definition with the
- <filename>/usr/share/i18n/charmaps/UTF-8.gz</filename>
- charmap definition and appends the result to the
- <filename>/usr/lib/locale/locale-archive</filename> file.
- The following instructions will install the minimum set of
- locales necessary for the optimal coverage of tests:</para-->
- <para>可以用 <command>localedef</command> 程序安装单独的 locale 。
- 例如,下面的第一个 <command>localedef</command> 命令将
- <filename>/usr/share/i18n/locales/cs_CZ</filename>
- 中的字符集无关 locale 定义和
- <filename>/usr/share/i18n/charmaps/UTF-8.gz</filename>
- 中的字符映射定义组合起来,并附加到
- <filename>/usr/lib/locale/locale-archive</filename> 文件。
- 以下命令将会安装能够覆盖测试所需的最小 locale 集合:</para>
- <screen role="nodump"><userinput remap="locale-test">mkdir -pv /usr/lib/locale
- localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8
- localedef -i de_DE -f ISO-8859-1 de_DE
- localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
- localedef -i de_DE -f UTF-8 de_DE.UTF-8
- localedef -i en_GB -f UTF-8 en_GB.UTF-8
- localedef -i en_HK -f ISO-8859-1 en_HK
- localedef -i en_PH -f ISO-8859-1 en_PH
- localedef -i en_US -f ISO-8859-1 en_US
- localedef -i en_US -f UTF-8 en_US.UTF-8
- localedef -i es_MX -f ISO-8859-1 es_MX
- localedef -i fa_IR -f UTF-8 fa_IR
- localedef -i fr_FR -f ISO-8859-1 fr_FR
- localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
- localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
- localedef -i it_IT -f ISO-8859-1 it_IT
- localedef -i it_IT -f UTF-8 it_IT.UTF-8
- localedef -i ja_JP -f EUC-JP ja_JP
- localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R
- localedef -i ru_RU -f UTF-8 ru_RU.UTF-8
- localedef -i tr_TR -f UTF-8 tr_TR.UTF-8
- localedef -i zh_CN -f GB18030 zh_CN.GB18030</userinput></screen>
- <!--para>In addition, install the locale for your own country, language and
- character set.</para-->
- <para>另外,安装适合您自己国家、语言和字符集的 locale 。</para>
- <note><title>译注</title><para>
- 建议中文用户安装 zh_CN.UTF-8 作为日常使用的 locale。GB18030
- 是为了后向兼容古老的 GB2312 而设计的编码,
- 在现代 Linux 系统和互联网使用时会引起一些奇怪的问题。
- 中华人民共和国国家标准化管理委员会的官方网站已经切换到 UTF-8。
- </para></note>
- <!--para>Alternatively, install all locales listed in the
- <filename>glibc-&glibc-version;/localedata/SUPPORTED</filename> file
- (it includes every locale listed above and many more) at once with the
- following time-consuming command:</para-->
- <para>或者,也可以一次安装
- <filename>glibc-&glibc-version;/localedata/SUPPORTED</filename>
- 中列出的所有 locale (包括上面列出的所有 locale,以及其他很多)。
- 执行下面这个需要很长时间的命令:</para>
- <screen><userinput remap="locale-full">make localedata/install-locales</userinput></screen>
- <!--para>Then use the <command>localedef</command> command to create and
- install locales not listed in the
- <filename>glibc-&glibc-version;/localedata/SUPPORTED</filename> file
- in the unlikely case you need them.</para-->
- <para>如果需要,再使用 <command>localedef</command> 命令创建和安装
- <filename>glibc-&glibc-version;/localedata/SUPPORTED</filename>
- 中没有列出的 locale ,当然您不太可能需要它们。</para>
- <note><para>目前 glibc 在解析国际化域名时使用 libidn2,
- 形成了一个运行时依赖关系。如果需要使用解析国际化域名的功能,参阅
- <ulink url="&blfs-book;general/libidn2.html">BLFS libidn2 页面</ulink>
- 安装 libidn2。
- </para></note>
- </sect2>
- <sect2 id="conf-glibc" role="configuration">
- <title>配置 Glibc</title>
- <indexterm zone="conf-glibc">
- <primary sortas="e-/etc/nsswitch.conf">/etc/nsswitch.conf</primary>
- </indexterm>
- <indexterm zone="conf-glibc">
- <primary sortas="e-/etc/localtime">/etc/localtime</primary>
- </indexterm>
- <sect3>
- <title>添加 nsswitch.conf</title>
- <!--para>The <filename>/etc/nsswitch.conf</filename> file needs to be created
- because the Glibc defaults do not work well in a networked environment.
- </para-->
- <para>由于 Glibc 的默认值在网络环境下不能很好地工作,
- 需要创建配置文件 <filename>/etc/nsswitch.conf</filename>。</para>
- <!--para>Create a new file <filename>/etc/nsswitch.conf</filename> by running the
- following:</para-->
- <para>执行以下命令创建新的 <filename>/etc/nsswitch.conf</filename>:
- </para>
- <screen><userinput>cat > /etc/nsswitch.conf << "EOF"
- <literal># Begin /etc/nsswitch.conf
- passwd: files
- group: files
- shadow: files
- hosts: files dns
- networks: files
- protocols: files
- services: files
- ethers: files
- rpc: files
- # End /etc/nsswitch.conf</literal>
- EOF</userinput></screen>
- </sect3>
- <sect3 id="conf-zone">
- <title>添加时区数据</title>
- <!--para>Install and set up the time zone data with the following:</para-->
- <para>输入以下命令,安装并设置时区数据:</para>
- <screen><userinput>tar -xf ../../tzdata&tzdata-version;.tar.gz
- ZONEINFO=/usr/share/zoneinfo
- mkdir -pv $ZONEINFO/{posix,right}
- for tz in etcetera southamerica northamerica europe africa antarctica \
- asia australasia backward pacificnew systemv; do
- zic -L /dev/null -d $ZONEINFO -y "sh yearistype.sh" ${tz}
- zic -L /dev/null -d $ZONEINFO/posix -y "sh yearistype.sh" ${tz}
- zic -L leapseconds -d $ZONEINFO/right -y "sh yearistype.sh" ${tz}
- done
- cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO
- zic -d $ZONEINFO -p America/New_York
- unset ZONEINFO</userinput></screen>
- <variablelist>
- <title>zic 命令的含义:</title>
- <varlistentry>
- <term><parameter>zic -L /dev/null ...</parameter></term>
- <listitem>
- <!--para>This creates posix time zones, without any leap seconds. It is
- conventional to put these in both
- <filename class="directory">zoneinfo</filename> and
- <filename class="directory">zoneinfo/posix</filename>. It is
- necessary to put the POSIX time zones in
- <filename class="directory">zoneinfo</filename>, otherwise various
- test-suites will report errors. On an embedded system, where space is
- tight and you do not intend to ever update the time zones, you could save
- 1.9MB by not using the <filename class="directory">posix</filename>
- directory, but some applications or test-suites might produce some
- failures.</para-->
- <para>该命令创建没有闰秒的 POSIX 时区。一般的惯例是将它们安装在
- <filename class="directory">zoneinfo</filename> 和
- <filename class="directory">zoneinfo/posix</filename>
- 两个目录中。前者是必须的,否则若干测试套件会报告错误。
- 在嵌入式系统上,如果存储空间十分紧张,
- 而且您永远不会更新时区信息,您可以不使用
- <filename class="directory">posix</filename> 目录,
- 以节约 1.9 MB,但个别程序或测试套件可能会失败。</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>zic -L leapseconds ...</parameter></term>
- <listitem>
- <!--para>This creates right time zones, including leap seconds. On an
- embedded system, where space is tight and you do not intend to
- ever update the time zones, or care about the correct time, you could
- save 1.9MB by omitting the <filename class="directory">right</filename>
- directory.</para-->
- <para>该命令创建正确的,包含闰秒的时区。在嵌入式系统上,
- 如果存储空间十分紧张,而且您永远不会更新时区信息,
- 也不关心系统时间是否正确,您可以跳过
- <filename class="directory">right</filename> 目录,
- 以节约 1.9 MB。</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>zic ... -p ...</parameter></term>
- <listitem>
- <!--para>This creates the <filename>posixrules</filename> file. We use
- New York because POSIX requires the daylight savings time rules
- to be in accordance with US rules.</para-->
- <para>该命令创建 <filename>posixrule</filename> 文件。
- 我们使用纽约时区,因为 POSIX 要求与美国一致的夏令时规则。
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <!--para>One way to determine the local time zone is to run the following
- script:</para-->
- <para>一种确定本地时区的方法是运行脚本:</para>
- <screen role="nodump"><userinput>tzselect</userinput></screen>
- <!--para>After answering a few questions about the location, the script will
- output the name of the time zone (e.g.,
- <emphasis>America/Edmonton</emphasis>). There are also some other possible
- time zones listed in <filename
- class='directory'>/usr/share/zoneinfo</filename> such as
- <emphasis>Canada/Eastern</emphasis> or <emphasis>EST5EDT</emphasis> that
- are not identified by the script but can be used.</para>
- <para>Then create the <filename>/etc/localtime</filename> file by
- running:</para-->
- <para>在回答关于当前位置的若干问题后,脚本会输出对应时区的名字
- (例如<emphasis>America/Edmonton</emphasis>)。
- 在 <filename class="directory">/usr/share/zoneinfo</filename>
- 中还有一些该脚本不能识别,但可以使用的时区,如
- <emphasis>Canada/Eastern</emphasis> 或者
- <emphasis>EST5EDT</emphasis>。</para>
- <para>确定时区后,执行以下命令,创建
- <filename>/etc/localtime</filename>:</para>
- <screen revision="sysv"><userinput>cp -v /usr/share/zoneinfo/<replaceable><xxx></replaceable> /etc/localtime</userinput></screen>
- <screen revision="systemd"><userinput>ln -sfv /usr/share/zoneinfo/<replaceable><xxx></replaceable> /etc/localtime</userinput></screen>
- <!--para>Replace <replaceable><xxx></replaceable> with the name of the
- time zone selected (e.g., Canada/Eastern).</para-->
- <para>将 <replaceable><xxx></replaceable> 替换成选定时区的名称
- (例如 Canada/Eastern)。</para>
- </sect3>
- <sect3 id="conf-ld" role="configuration">
- <title>配置动态加载器</title>
- <indexterm zone="conf-ld">
- <primary sortas="e-/etc/ld.so.conf">/etc/ld.so.conf</primary>
- </indexterm>
- <!--para>By default, the dynamic loader (<filename
- class="libraryfile">/lib/ld-linux.so.2</filename>) searches through
- <filename class="directory">/lib</filename> and <filename
- class="directory">/usr/lib</filename> for dynamic libraries that are
- needed by programs as they are run. However, if there are libraries in
- directories other than <filename class="directory">/lib</filename> and
- <filename class="directory">/usr/lib</filename>, these need to be added
- to the <filename>/etc/ld.so.conf</filename> file in order for the
- dynamic loader to find them. Two directories that are commonly known
- to contain additional libraries are <filename
- class="directory">/usr/local/lib</filename> and <filename
- class="directory">/opt/lib</filename>, so add those directories to the
- dynamic loader's search path.</para-->
- <para>默认情况下,动态加载器
- (<filename class="libraryfile">/lib/ld-linux.so.2</filename>)
- 在 <filename class="directory">/lib</filename> 和
- <filename class="directory">/usr/lib</filename>
- 中搜索程序运行时需要的动态库。然而,如果在其他目录中有动态库,
- 为了使动态加载器能够找到它们,需要把这些目录添加到文件
- <filename>/etc/ld.so.conf</filename> 中。
- 有两个目录 <filename class="directory">/usr/local/lib</filename>
- 和 <filename class="directory">/opt/lib</filename>
- 经常包含附加的共享库,所以现在将它们添加到动态加载器的搜索目录中。
- </para>
- <!--para>Create a new file <filename>/etc/ld.so.conf</filename> by running the
- following:</para-->
- <para>运行以下命令,创建一个新的 <filename>/etc/ld.so.conf</filename>:
- </para>
- <screen><userinput>cat > /etc/ld.so.conf << "EOF"
- <literal># Begin /etc/ld.so.conf
- /usr/local/lib
- /opt/lib
- </literal>
- EOF</userinput></screen>
- <!--para>If desired, the dynamic loader can also search a directory and
- include the contents of files found there. Generally the files in
- this include directory are one line specifying the desired library path.
- To add this capability run the following commands:</para-->
- <para>如果希望的话,动态加载器也可以搜索一个目录,并将其中的文件包含在
- <filename>ld.so.conf</filename> 中。
- 通常包含文件目录中的文件只有一行,指定一个期望的库文件目录。
- 如果需要这项功能,执行以下命令:</para>
- <screen role="nodump"><userinput>cat >> /etc/ld.so.conf << "EOF"
- <literal># Add an include directory
- include /etc/ld.so.conf.d/*.conf
- </literal>
- EOF
- mkdir -pv /etc/ld.so.conf.d</userinput></screen>
- </sect3>
- </sect2>
- <sect2 id="contents-glibc" role="content">
- <title>Glibc 的内容</title>
- <segmentedlist>
- <segtitle>安装的程序</segtitle>
- <segtitle>安装的库</segtitle>
- <segtitle>安装的目录</segtitle>
- <seglistitem>
- <seg>catchsegv, gencat, getconf, getent, iconv, iconvconfig, ldconfig,
- ldd, lddlibc4, locale, localedef, makedb, mtrace, nscd,
- pldd, sln, sotruss, sprof, tzselect, xtrace,
- zdump, 以及 zic</seg>
- <seg>ld-&glibc-version;.so, libBrokenLocale.{a,so}, libSegFault.so, libanl.{a,so},
- libc.{a,so}, libc_nonshared.a, libcidn.so,
- libcrypt.{a,so}, libdl.{a,so}, libg.a, libieee.a, libm.{a,so},
- libmcheck.a, libmemusage.so, libnsl.{a,so}, libnss_compat.so,
- libnss_dns.so, libnss_files.so, libnss_hesiod.so, libnss_nis.so,
- libnss_nisplus.so, libpthread.{a,so},
- libpthread_nonshared.a, libresolv.{a,so}, librpcsvc.a, librt.{a,so},
- libthread_db.so, 以及 libutil.{a,so}</seg>
- <seg>/usr/include/arpa, /usr/include/bits, /usr/include/gnu,
- /usr/include/net, /usr/include/netash, /usr/include/netatalk,
- /usr/include/netax25, /usr/include/neteconet, /usr/include/netinet,
- /usr/include/netipx, /usr/include/netiucv, /usr/include/netpacket,
- /usr/include/netrom, /usr/include/netrose, /usr/include/nfs,
- /usr/include/protocols, /usr/include/rpc, /usr/include/rpcsvc,
- /usr/include/sys, /usr/lib/audit, /usr/lib/gconv, /usr/lib/locale,
- /usr/libexec/getconf, /usr/share/i18n, /usr/share/zoneinfo,
- /var/cache/nscd, 以及 /var/lib/nss_db</seg>
- </seglistitem>
- </segmentedlist>
- <variablelist>
- <bridgehead renderas="sect3">简要描述</bridgehead>
- <?dbfo list-presentation="list"?>
- <?dbhtml list-presentation="table"?>
- <varlistentry id="catchsegv">
- <term><command>catchsegv</command></term>
- <listitem>
- <para>在程序因为段错误而终止时创建栈跟踪</para>
- <indexterm zone="ch-system-glibc catchsegv">
- <primary sortas="b-catchsegv">catchsegv</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="gencat">
- <term><command>gencat</command></term>
- <listitem>
- <para>生成消息目录</para>
- <indexterm zone="ch-system-glibc gencat">
- <primary sortas="b-gencat">gencat</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="getconf">
- <term><command>getconf</command></term>
- <listitem>
- <para>显示文件系统指定的系统配置变量值</para>
- <indexterm zone="ch-system-glibc getconf">
- <primary sortas="b-getconf">getconf</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="getent">
- <term><command>getent</command></term>
- <listitem>
- <para>从管理数据库取得条目</para>
- <indexterm zone="ch-system-glibc getent">
- <primary sortas="b-getent">getent</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="iconv">
- <term><command>iconv</command></term>
- <listitem>
- <para>转换给定文件的编码</para>
- <indexterm zone="ch-system-glibc iconv">
- <primary sortas="b-iconv">iconv</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="iconvconfig">
- <term><command>iconvconfig</command></term>
- <listitem>
- <para>创建快速装入 <command>iconv</command> 模块配置文件</para>
- <indexterm zone="ch-system-glibc iconvconfig">
- <primary sortas="b-iconvconfig">iconvconfig</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="ldconfig">
- <term><command>ldconfig</command></term>
- <listitem>
- <para>设置运行时动态链接</para>
- <indexterm zone="ch-system-glibc ldconfig">
- <primary sortas="b-ldconfig">ldconfig</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="ldd">
- <term><command>ldd</command></term>
- <listitem>
- <para>报告给定程序或共享库依赖于哪些共享库</para>
- <indexterm zone="ch-system-glibc ldd">
- <primary sortas="b-ldd">ldd</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="lddlibc4">
- <term><command>lddlibc4</command></term>
- <listitem>
- <para>辅助 <command>ldd</command> 处理对象文件</para>
- <indexterm zone="ch-system-glibc lddlibc4">
- <primary sortas="b-lddlibc4">lddlibc4</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="locale">
- <term><command>locale</command></term>
- <listitem>
- <para>给出当前区域的一些信息</para>
- <indexterm zone="ch-system-glibc locale">
- <primary sortas="b-locale">locale</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="localedef">
- <term><command>localedef</command></term>
- <listitem>
- <para>编译 locale 规范</para>
- <indexterm zone="ch-system-glibc localedef">
- <primary sortas="b-localedef">localedef</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="makedb">
- <term><command>makedb</command></term>
- <listitem>
- <para>从文本输入创建简单的数据库</para>
- <indexterm zone="ch-system-glibc makedb">
- <primary sortas="b-makedb">makedb</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="mtrace">
- <term><command>mtrace</command></term>
- <listitem>
- <para>读取并解析内存跟踪文件,以人类可读的形式输出内存跟踪信息
- </para>
- <indexterm zone="ch-system-glibc mtrace">
- <primary sortas="b-mtrace">mtrace</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="nscd">
- <term><command>nscd</command></term>
- <listitem>
- <para>一个缓存最常见命名服务请求的守护进程</para>
- <indexterm zone="ch-system-glibc nscd">
- <primary sortas="b-nscd">nscd</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="pldd">
- <term><command>pldd</command></term>
- <listitem>
- <para>列出正在运行的进程使用的共享库</para>
- <indexterm zone="ch-system-glibc pldd">
- <primary sortas="b-pldd">pldd</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="sln">
- <term><command>sln</command></term>
- <listitem>
- <para>静态链接的 <command>ln</command> 程序</para>
- <indexterm zone="ch-system-glibc sln">
- <primary sortas="b-sln">sln</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="sotruss">
- <term><command>sotruss</command></term>
- <listitem>
- <para>跟踪特定命令对共享库中子程序的调用</para>
- <indexterm zone="ch-system-glibc sotruss">
- <primary sortas="b-sotruss">sotruss</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="sprof">
- <term><command>sprof</command></term>
- <listitem>
- <para>读取并显示共享库性能剖析数据</para>
- <indexterm zone="ch-system-glibc sprof">
- <primary sortas="b-sprof">sprof</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="tzselect">
- <term><command>tzselect</command></term>
- <listitem>
- <para>询问用户系统所在的位置并报告对应的时区</para>
- <indexterm zone="ch-system-glibc tzselect">
- <primary sortas="b-tzselect">tzselect</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="xtrace">
- <term><command>xtrace</command></term>
- <listitem>
- <para>显示正在执行的函数以跟踪程序执行</para>
- <indexterm zone="ch-system-glibc xtrace">
- <primary sortas="b-xtrace">xtrace</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="zdump">
- <term><command>zdump</command></term>
- <listitem>
- <para>输出当前时间在多个时区中的表示</para>
- <indexterm zone="ch-system-glibc zdump">
- <primary sortas="b-zdump">zdump</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="zic">
- <term><command>zic</command></term>
- <listitem>
- <para>时区编译器</para>
- <indexterm zone="ch-system-glibc zic">
- <primary sortas="b-zic">zic</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="ld.so">
- <term><filename class="libraryfile">ld-&glibc-version;.so</filename></term>
- <listitem>
- <para>动态链接器/加载器</para>
- <indexterm zone="ch-system-glibc ld.so">
- <primary sortas="c-ld.so">ld-&glibc-version;.so</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libBrokenLocale">
- <term><filename class="libraryfile">libBrokenLocale</filename></term>
- <listitem>
- <para>被 Glibc 内部用作使某些不正确的程序(例如某些 Motif 程序)
- 正常运行的粗糙手段,参阅
- <filename>glibc-&glibc-version;/locale/broken_cur_max.c</filename>
- 中的注释了解更多信息</para>
- <indexterm zone="ch-system-glibc libBrokenLocale">
- <primary sortas="c-libBrokenLocale">libBrokenLocale</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libSegFault">
- <term><filename class="libraryfile">libSegFault</filename></term>
- <listitem>
- <para><command>catchsegv</command> 使用的段错误信号处理程序
- </para>
- <indexterm zone="ch-system-glibc libSegFault">
- <primary sortas="c-libSegFault">libSegFault</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libanl">
- <term><filename class="libraryfile">libanl</filename></term>
- <listitem>
- <para>异步的命名查找库</para>
- <indexterm zone="ch-system-glibc libanl">
- <primary sortas="c-libanl">libanl</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libc">
- <term><filename class="libraryfile">libc</filename></term>
- <listitem>
- <para>主要的 C 运行库</para>
- <indexterm zone="ch-system-glibc libc">
- <primary sortas="c-libc">libc</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libcidn">
- <term><filename class="libraryfile">libcidn</filename></term>
- <listitem>
- <para>被 Glibc 内部的 <function>getaddrinfo</function> 函数
- 用于处理国际化域名</para>
- <indexterm zone="ch-system-glibc libcidn">
- <primary sortas="c-libcidn">libcidn</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libcrypt">
- <term><filename class="libraryfile">libcrypt</filename></term>
- <listitem>
- <para>密码学库</para>
- <indexterm zone="ch-system-glibc libcrypt">
- <primary sortas="c-libcrypt">libcrypt</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libdl">
- <term><filename class="libraryfile">libdl</filename></term>
- <listitem>
- <para>动态链接接口库</para>
- <indexterm zone="ch-system-glibc libdl">
- <primary sortas="c-libdl">libdl</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libg">
- <term><filename class="libraryfile">libg</filename></term>
- <listitem>
- <para>没有功能的空库,曾经是 <command>g++</command> 的运行库。
- </para>
- <indexterm zone="ch-system-glibc libg">
- <primary sortas="c-libg">libg</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libieee">
- <term><filename class="libraryfile">libieee</filename></term>
- <listitem>
- <!--para>Linking in this module forces error handling rules for math
- functions as defined by the Institute of Electrical and Electronic
- Engineers (IEEE). The default is POSIX.1 error handling</para-->
- <para>链接该库以使用国际电气电子工程师学会(IEEE)
- 定义的数学函数错误处理规则,而不是默认的 POSIX.1 错误处理。
- </para>
- <indexterm zone="ch-system-glibc libieee">
- <primary sortas="c-libieee">libieee</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libm">
- <term><filename class="libraryfile">libm</filename></term>
- <listitem>
- <para>数学库</para>
- <indexterm zone="ch-system-glibc libm">
- <primary sortas="c-libm">libm</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libmcheck">
- <term><filename class="libraryfile">libmcheck</filename></term>
- <listitem>
- <para>链接到该库时启用内存分配检查</para>
- <indexterm zone="ch-system-glibc libmcheck">
- <primary sortas="c-libmcheck">libmcheck</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libmemusage">
- <term><filename class="libraryfile">libmemusage</filename></term>
- <listitem>
- <para>被 <command>memusage</command> 用于收集程序内存使用信息
- </para>
- <indexterm zone="ch-system-glibc libmemusage">
- <primary sortas="c-libmemusage">libmemusage</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libnsl">
- <term><filename class="libraryfile">libnsl</filename></term>
- <listitem>
- <para>网络服务库</para>
- <indexterm zone="ch-system-glibc libnsl">
- <primary sortas="c-libnsl">libnsl</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libnss">
- <term><filename class="libraryfile">libnss</filename></term>
- <listitem>
- <para>命名服务开关库,包含用于解析域名、用户名、组名、代号、
- 服务、协议等的函数。</para>
- <indexterm zone="ch-system-glibc libnss">
- <primary sortas="c-libnss">libnss</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libpthread">
- <term><filename class="libraryfile">libpthread</filename></term>
- <listitem>
- <para>POSIX 线程库</para>
- <indexterm zone="ch-system-glibc libpthread">
- <primary sortas="c-libpthread">libpthread</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libresolv">
- <term><filename class="libraryfile">libresolv</filename></term>
- <listitem>
- <para>包含用于创建、发送和解析因特网域名服务数据包的函数。</para>
- <indexterm zone="ch-system-glibc libresolv">
- <primary sortas="c-libresolv">libresolv</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="librpcsvc">
- <term><filename class="libraryfile">librpcsvc</filename></term>
- <listitem>
- <para>包含一些 RPC 服务函数</para>
- <indexterm zone="ch-system-glibc librpcsvc">
- <primary sortas="c-librpcsvc">librpcsvc</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="librt">
- <term><filename class="libraryfile">librt</filename></term>
- <listitem>
- <para>包含 POSIX.1b 实时扩展要求的多数接口</para>
- <indexterm zone="ch-system-glibc librt">
- <primary sortas="c-librt">librt</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libthread_db">
- <term><filename class="libraryfile">libthread_db</filename></term>
- <listitem>
- <para>包含用于构建多线程程序调试的函数器</para>
- <indexterm zone="ch-system-glibc libthread_db">
- <primary sortas="c-libthread_db">libthread_db</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- <varlistentry id="libutil">
- <term><filename class="libraryfile">libutil</filename></term>
- <listitem>
- <para>包含许多 Unix 工具使用的 <quote>标准</quote> 函数</para>
- <indexterm zone="ch-system-glibc libutil">
- <primary sortas="c-libutil">libutil</primary>
- </indexterm>
- </listitem>
- </varlistentry>
- </variablelist>
- </sect2>
- </sect1>
|