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

📄 glibc-headers.html

📁 CLFS(Cross-Compiled Linux From Scratch)的文档 Version CLFS-SVN-20060417
💻 HTML
字号:
<!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>      5.6.&nbsp;Glibc-2.4 Headers    </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-ALPHA">    <div class="navheader">      <div class="headertitles">        <h4>          Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-ALPHA        </h4>        <h3>          Chapter&nbsp;5.&nbsp;Constructing Cross-Compile Tools        </h3>      </div>      <ul class="headerlinks">        <li class="prev">          <a accesskey="p" href="binutils.html" title=          "Cross Binutils-2.16.1">Prev</a>          <p>            Cross Binutils-2.16.1          </p>        </li>        <li class="next">          <a accesskey="n" href="gcc-static.html" title=          "Cross GCC-4.1.0 - Static">Next</a>          <p>            Cross GCC-4.1.0 - Static          </p>        </li>        <li class="up">          <a accesskey="u" href="chapter.html" title=          "Chapter&nbsp;5.&nbsp;Constructing Cross-Compile Tools">Up</a>.        </li>        <li class="home">          <a accesskey="h" href="../index.html" title=          "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-ALPHA">          Home</a>        </li>      </ul>    </div>    <div class="wrap" lang="en" xml:lang="en">      <div class="titlepage">        <h1 class="sect1">          5.6. Glibc-2.4 Headers        </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">            5.6.1. Installation of Glibc Headers          </h2>        </div>        <p>          The following sed removes a dependency of gcc 3.4.x from the glibc          we are using in cross-lfs. The reason we are changing it is because          this only installs the headers, no compiling takes place. In the          next glibc chapter, we use the gcc that's build right after this          chapter.        </p>        <pre class="userinput"><kbd class="command">cp configure{,.orig}sed -e 's/3.4/3.[0-9]/g' configure.orig &gt; configure</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>          For NPTL enabled systems the following lines need to be added to          <tt class="filename">config.cache</tt>:        </p>        <pre class="userinput"><kbd class="command">echo "libc_cv_forced_unwind=yes" &gt; config.cacheecho "libc_cv_c_cleanup=yes" &gt;&gt; config.cacheecho "libc_cv_mlong_double_128=yes" &gt;&gt; config.cacheecho "ibc_cv_alpha_tls=yes" &gt;&gt; config.cache</kbd></pre>        <p>          Prepare Glibc for compilation:        </p>        <pre class="userinput"><kbd class="command">CC=gcc ../glibc-2.4/configure --prefix=/tools \   --host=${LFS_TARGET} --build=${LFS_HOST} \   --disable-sanity-checks --enable-kernel=2.6.0 \   --with-headers=/tools/include --cache-file=config.cache \   --with-binutils=/cross-tools/${LFS_TARGET}/bin</kbd></pre>        <div class="warning">          <div class="admonhead">            <img alt="[Warning]" src="../images/warning.png" />            <h3 class="admontitle">              Warning            </h3>          </div>          <div class="admonbody">            <p>              <span class="emphasis"><em>Any</em></span> error message you              see about nptl at this point can safely be ignored.            </p>          </div>        </div>        <div class="variablelist">          <p class="title">            <b>The meaning of the configure options:</b>          </p>          <dl>            <dt>              <span class="term"><em class=              "parameter"><tt>CC=gcc</tt></em></span>            </dt>            <dd>              <p>                Tells GLIBC to use the hosts GCC compiler.              </p>            </dd>            <dt>              <span class="term"><em class=              "parameter"><tt>--prefix=/tools</tt></em></span>            </dt>            <dd>              <p>                This tells the configure script to prepare to install the                package in the <tt class="filename">/tools</tt> directory.              </p>            </dd>            <dt>              <span class="term"><em class=              "parameter"><tt>--build=${LFS_HOST}</tt></em></span>            </dt>            <dd>              <p>                When used with --host, this creates a cross-architecture                executable that creates files for ${LFS_TARGET} but runs on                ${LFS_HOST).              </p>            </dd>            <dt>              <span class="term"><em class=              "parameter"><tt>--host=${LFS_TARGET}</tt></em></span>            </dt>            <dd>              <p>                When used with --build, this creates a cross-architecture                executable that creates files for ${LFS_TARGET} but runs on                ${LFS_HOST).              </p>            </dd>            <dt>              <span class="term"><em class=              "parameter"><tt>--disable-sanity-checks</tt></em></span>            </dt>            <dd>              <p>                This switch disables any checks that are in place.              </p>            </dd>            <dt>              <span class="term"><em class=              "parameter"><tt>--enable-kernel=2.6.0</tt></em></span>            </dt>            <dd>              <p>                This tells Glibc to compile the library with support for                2.6.x Linux kernels.              </p>            </dd>            <dt>              <span class="term"><em class=              "parameter"><tt>--with-headers=/tools/include</tt></em></span>            </dt>            <dd>              <p>                This tells Glibc to compile itself against the headers                recently installed to the <tt class="filename">/tools</tt>                directory, so that it knows exactly what features the kernel                has and can optimize itself accordingly.              </p>            </dd>            <dt>              <span class="term"><em class=              "parameter"><tt>--with-binutils=/cross-tools/${LFS_TARGET}/bin</tt></em></span>            </dt>            <dd>              <p>                This tells GLIBC to use the binutils for our specific target                architecture.              </p>            </dd>          </dl>        </div>        <p>          Now, install the headers:        </p>        <pre class="userinput"><kbd class="command">make install-headers</kbd></pre>        <p>          Some files aren't installed by the above command, then we will copy          the header files we need:        </p>        <p>          First we will copy a common file over to <tt class=          "filename">/tools/include</tt>:        </p>        <pre class="userinput"><kbd class="command">install -d /tools/include/bitscp bits/stdio_lim.h /tools/include/bits</kbd></pre>        <p>          Now we will create a blank stub file:        </p>        <pre class="userinput"><kbd class="command">touch /tools/include/gnu/stubs.h</kbd></pre>        <p>          For NPTL we use the following command:        </p>        <pre class="userinput"><kbd class="command">cp -v ../glibc-2.4/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h /tools/include/bits/</kbd></pre>      </div>      <div class="content" lang="en" xml:lang="en">        <p>          Details on this package are located in <a href=          "../final-system/glibc.html#contents-glibc" title=          "10.6.5.&nbsp;Contents of Glibc">Section&nbsp;10.6.5,          &ldquo;Contents of Glibc.&rdquo;</a>        </p>      </div>    </div>    <div class="navfooter">      <ul>        <li class="prev">          <a accesskey="p" href="binutils.html" title=          "Cross Binutils-2.16.1">Prev</a>          <p>            Cross Binutils-2.16.1          </p>        </li>        <li class="next">          <a accesskey="n" href="gcc-static.html" title=          "Cross GCC-4.1.0 - Static">Next</a>          <p>            Cross GCC-4.1.0 - Static          </p>        </li>        <li class="up">          <a accesskey="u" href="chapter.html" title=          "Chapter&nbsp;5.&nbsp;Constructing Cross-Compile Tools">Up</a>.        </li>        <li class="home">          <a accesskey="h" href="../index.html" title=          "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-ALPHA">          Home</a>.        </li>      </ul>    </div>  </body></html>

⌨️ 快捷键说明

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