⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glibc.html

📁 CLFS(Cross-Compiled Linux From Scratch)的文档 Version CLFS-SVN-20060417
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">  <head>    <meta http-equiv="Content-Type" content=    "application/xhtml+xml; charset=iso-8859-1" />    <title>      10.6.&nbsp;Glibc-2.4    </title>    <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" />    <meta name="generator" content="DocBook XSL Stylesheets V1.69.1" />    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=    "text/css" media="print" />  </head>  <body id="lfs" class="CLFS-SVN-20060417-x86_64-Pure64">    <div class="navheader">      <div class="headertitles">        <h4>          Cross-Compiled Linux From Scratch - Version          CLFS-SVN-20060417-x86_64-Pure64        </h4>        <h3>          Chapter&nbsp;10.&nbsp;Installing Basic System Software        </h3>      </div>      <ul class="headerlinks">        <li class="prev">          <a accesskey="p" href="linux-libc-headers.html" title=          "Linux-Libc-Headers-2.6.12.0">Prev</a>          <p>            Linux-Libc-Headers-2.6.12.0          </p>        </li>        <li class="next">          <a accesskey="n" href="adjusting.html" title=          "Adjusting the Toolchain">Next</a>          <p>            Adjusting the Toolchain          </p>        </li>        <li class="up">          <a accesskey="u" href="chapter.html" title=          "Chapter&nbsp;10.&nbsp;Installing Basic System Software">Up</a>.        </li>        <li class="home">          <a accesskey="h" href="../index.html" title=          "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-x86_64-Pure64">          Home</a>        </li>      </ul>    </div>    <div class="wrap" lang="en" xml:lang="en">      <div class="titlepage">        <h1 class="sect1">          10.6. Glibc-2.4        </h1>      </div>      <div class="package" lang="en" xml:lang="en">        <p>          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.        </p>        <div class="segmentedlist">          <div class="seglistitem">            <div class="seg">              <strong><span class="segtitle">Installation depends              on:</span></strong> <span class="seg">Bash, Binutils,              Coreutils, Diffutils, Gawk, GCC, Gettext, Grep, Make, Patch,              Perl, Sed, and Texinfo</span>            </div>          </div>        </div>      </div>      <div class="installation" lang="en" xml:lang="en">        <div class="titlepage">          <h2 class="sect2">            10.6.1. Installation of Glibc          </h2>        </div>        <div class="note">          <div class="admonhead">            <img alt="[Note]" src="../images/note.png" />            <h3 class="admontitle">              Note            </h3>          </div>          <div class="admonbody">            <p>              Some packages outside of LFS suggest installing GNU libiconv in              order to translate data from one encoding to another. The              project's home page (<a href=              "http://www.gnu.org/software/libiconv/"><i>http://www.gnu.org/software/libiconv/</i></a>)              says &ldquo;<span class="quote">This library provides an              <tt class="function">iconv()</tt> implementation, for use on              systems which don't have one, or whose implementation cannot              convert from/to Unicode.</span>&rdquo; Glibc provides an              <tt class="function">iconv()</tt> implementation and can              convert from/to Unicode, therefore libiconv is not required on              an LFS system.            </p>          </div>        </div>        <p>          The Glibc build system is self-contained and will install          perfectly, even though the compiler specs file and linker are still          pointing at <tt class="filename">/tools</tt>. 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.        </p>        <p>          The following patch removes the potential of localdef segfaulting:        </p>        <pre class="userinput"><kbd class="command">patch -Np1 -i ../glibc-2.4-localedef_segfault-1.patch</kbd></pre>        <p>          The following sed fixes a build issue with Glibc. This will prevent          nscd from trying to link to libraries that don't exist:        </p>        <pre class="userinput"><kbd class="command">cp nscd/Makefile{,.orig}sed -e "/nscd_stat.o: sysincludes = # nothing/d" nscd/Makefile.orig &gt; \nscd/Makefile</kbd></pre>        <p>          The Glibc documentation recommends building Glibc outside of the          source directory in a dedicated build directory:        </p>        <pre class="userinput"><kbd class="command">mkdir -v ../glibc-buildcd ../glibc-build</kbd></pre>        <p>          Now we make sure the Glibc goes into <tt class=          "filename">/lib</tt>:        </p>        <pre class="userinput"><kbd class="command">echo "slibdir=/lib" &gt;&gt; configparms</kbd></pre>        <p>          Prepare Glibc for compilation:        </p>        <pre class="userinput"><kbd class="command">../glibc-2.4/configure --prefix=/usr \    --disable-profile --enable-add-ons --enable-kernel=2.6.0 \    --libexecdir=/usr/lib/glibc --libdir=/usr/lib</kbd></pre>        <div class="variablelist">          <p class="title">            <b>The meaning of the new configure option:</b>          </p>          <dl>            <dt>              <span class="term"><em class=              "parameter"><tt>--libexecdir=/usr/lib/glibc</tt></em></span>            </dt>            <dd>              <p>                This changes the location of the <span><strong class=                "command">pt_chown</strong></span> program from its default                of <tt class="filename">/usr/libexec</tt> to <tt class=                "filename">/usr/lib64/glibc</tt>.              </p>            </dd>          </dl>        </div>        <p>          Compile the package:        </p>        <pre class="userinput"><kbd class="command">make</kbd></pre>        <div class="important">          <div class="admonhead">            <img alt="[Important]" src="../images/important.png" />            <h3 class="admontitle">              Important            </h3>          </div>          <div class="admonbody">            <p>              In this section, the test suite for Glibc is considered              critical. Do not skip it under any circumstance.            </p>          </div>        </div>        <p>          Test the results:        </p>        <pre class="userinput"><kbd class="command">make check</kbd></pre>        <p>          Though it is a harmless message, the install stage of Glibc will          complain about the absence of <tt class=          "filename">/etc/ld.so.conf</tt>. Prevent this warning with:        </p>        <pre class="userinput"><kbd class="command">touch /etc/ld.so.conf</kbd></pre>        <p>          The install will finish by checking that everything is correctly          installed. Unfortunately, it will test for a multilib installation.          On x86_64 Pure64 this means it will try to test the non-existent          32-bit loader which has a different name from the 64-bit loader          (unlike on other 64-bit architectures). We fool it by creating a          symlink to the real loader.        </p>        <pre class="userinput"><kbd class="command">ln -sv ld-2.4.so /lib/ld-linux.so.2</kbd></pre>        <p>          Install the package:        </p>        <pre class="userinput"><kbd class="command">make install</kbd></pre>        <p>          Now we can remove this symlink. We also need to correct the          <span><strong class="command">/usr/bin/ldd</strong></span> script -          if you look at this, you will see it references not only the 32-bit          linker, but also /lib64 where it thinks the 64-bit linker is. The          following <span><strong class="command">sed</strong></span> will          correct this.        </p>        <pre class="userinput"><kbd class="command">rm -v /lib/ld-linux.so.2cp -v /usr/bin/ldd{,.bak}sed '/RTLDLIST/s%/ld-linux.so.2 /lib64%%' /usr/bin/ldd.bak &gt;/usr/bin/ldd</kbd></pre>        <p>          Check the script to make sure the sed worked correctly, then delete          the backup.        </p>        <pre class="userinput"><kbd class="command">rm -v /usr/bin/ldd.bak</kbd></pre>      </div>      <div class="configuration" lang="en" xml:lang="en">        <div class="titlepage">          <a id="i18n-glibc" name="i18n-glibc"></a>          <h2 class="sect2">            10.6.2. Internationalization          </h2>        </div>        <p>          The locales that can make the system respond in a different          language were not installed by the above command. Install them          with:        </p>        <pre class="userinput"><kbd class="command">make localedata/install-locales</kbd></pre>        <p>          To save time, an alternative to running the previous command (which          generates and installs every locale listed in the          glibc-2.4/localedata/SUPPORTED file) is to install only those          locales that are wanted and needed. This can be achieved by using          the <span><strong class="command">localedef</strong></span>          command. Information on this command is located in the <tt class=          "filename">INSTALL</tt> file in the Glibc source. However, there          are a number of locales that are essential in order for the tests          of future packages to pass, in particular, the <span class=          "emphasis"><em>libstdc++</em></span> tests from GCC. The following          instructions, instead of the <em class=          "parameter"><tt>install-locales</tt></em> target used above, will          install the minimum set of locales necessary for the tests to run          successfully:        </p>        <pre class="userinput"><kbd class="command">mkdir -pv /usr/lib/localelocaledef -i de_DE -f ISO-8859-1 de_DElocaledef -i de_DE@euro -f ISO-8859-15 de_DE@eurolocaledef -i en_HK -f ISO-8859-1 en_HKlocaledef -i en_PH -f ISO-8859-1 en_PHlocaledef -i en_US -f ISO-8859-1 en_USlocaledef -i es_MX -f ISO-8859-1 es_MXlocaledef -i fa_IR -f UTF-8 fa_IRlocaledef -i fr_FR -f ISO-8859-1 fr_FRlocaledef -i fr_FR@euro -f ISO-8859-15 fr_FR@eurolocaledef -i it_IT -f ISO-8859-1 it_ITlocaledef -i ja_JP -f EUC-JP ja_JP</kbd></pre>        <p>          Some locales installed by the <span><strong class="command">make          localedata/install-locales</strong></span> command above are not          properly supported by some applications that are in the LFS and          BLFS books. Because of the various problems that arise due to          application programmers making assumptions that break in such          locales, LFS should not be used in locales that utilize multibyte          character sets (including UTF-8) or right-to-left writing order.          Numerous unofficial and unstable patches are required to fix these          problems, and it has been decided by the LFS developers not to          support such complex locales at this time. This applies to the          ja_JP and fa_IR locales as well&mdash;they have been installed only          for GCC and Gettext tests to pass, and the <span><strong class=          "command">watch</strong></span> program (part of the Procps          package) does not work properly in them. Various attempts to          circumvent these restrictions are documented in          internationalization-related hints.        </p>      </div>      <div class="configuration" lang="en" xml:lang="en">        <div class="titlepage">          <a id="conf-glibc" name="conf-glibc"></a>          <h2 class="sect2">            10.6.3. Configuring Glibc          </h2>        </div>        <p>          The <tt class="filename">/etc/nsswitch.conf</tt> file needs to be          created because, although Glibc provides defaults when this file is          missing or corrupt, the Glibc defaults do not work well in a          networked environment. The time zone also needs to be configured.        </p>        <p>          Create a new file <tt class="filename">/etc/nsswitch.conf</tt> by          running the following:        </p>        <pre class="userinput"><kbd class="command">cat &gt; /etc/nsswitch.conf &lt;&lt; "EOF"<tt class="literal"># Begin /etc/nsswitch.confpasswd: filesgroup: filesshadow: fileshosts: files dnsnetworks: filesprotocols: filesservices: filesethers: filesrpc: files# End /etc/nsswitch.conf</tt>EOF</kbd></pre>        <p>          To determine the local time zone, run the following script:        </p>        <pre class="userinput"><kbd class="command">tzselect</kbd></pre>        <p>          After answering a few questions about the location, the script will          output the name of the time zone (e.g., <span class=          "emphasis"><em>EST5EDT</em></span> or <span class=          "emphasis"><em>Canada/Eastern</em></span>). Then create the

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -