<?xml version="1.0" encoding="ISO-8859-1"?>
<!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-cross-tools-glibc" role="wrap">
  <?dbhtml filename="glibc.html"?>

  <title>GLIBC-&glibc-version;</title>

  <indexterm zone="ch-cross-tools-glibc">
    <primary sortas="a-GLIBC">GLIBC</primary>
    <secondary>cross tools</secondary>
  </indexterm>

  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
  href="../../final-system/common/glibc.xml"
  xpointer="xpointer(//*[@role='package'])"/>

  <sect2 role="installation">
    <title>Installation of GLIBC</title>

    <para os="da">It should be noted that compiling GLIBC in any way other than
    the method suggested in this book puts the stability of the system at
    risk.</para>

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="../../final-system/common/glibc.xml"
    xpointer="xpointer(//*[@os='s1'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="../../final-system/common/glibc.xml"
    xpointer="xpointer(//*[@os='s2'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="../../final-system/common/glibc.xml"
    xpointer="xpointer(//*[@os='e'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="../../final-system/common/glibc.xml"
    xpointer="xpointer(//*[@os='f'])"/>

    <para os="dd">Add the following to <filename>config.cache</filename>
    to disable ssp when building GLIBC:</para>

<screen os="de"><userinput>echo "libc_cv_ssp=no" &gt; config.cache</userinput></screen>

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="../../final-system/common/glibc.xml"
    xpointer="xpointer(//*[@os='g'])"/>

<screen os="df"><userinput>BUILD_CC="gcc" CC="${CLFS_TARGET}-gcc" \
    AR="${CLFS_TARGET}-ar" RANLIB="${CLFS_TARGET}-ranlib" \
    ../glibc-&glibc-version;/configure --prefix=/tools \
    --host=${CLFS_TARGET} --build=${CLFS_HOST} \
    --disable-profile --with-tls --enable-kernel=2.6.32 \
    --with-__thread --with-binutils=/cross-tools/bin \
    --with-headers=/tools/include --enable-obsolete-rpc \
    --cache-file=config.cache</userinput></screen>

    <variablelist os="dg">
      <title>The meaning of the new configure options:</title>

      <varlistentry os="dg1">
        <term><parameter>BUILD_CC="gcc"</parameter></term>
        <listitem>
          <para>This sets GLIBC to use the current compiler on our system. This is
          used to create the tools GLIBC uses during its build.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="dg2">
        <term><parameter>CC="${CLFS_TARGET}-gcc"</parameter></term>
        <listitem>
          <para>This forces GLIBC to use the GCC compiler that we made for our target
          architecture.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="dg3">
        <term><parameter>AR="${CLFS_TARGET}-ar"</parameter></term>
        <listitem>
          <para>This forces GLIBC to use the <command>ar</command> utility
          we made for our target architecture.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="dg4">
        <term><parameter>RANLIB="${CLFS_TARGET}-ranlib"</parameter></term>
        <listitem>
          <para>This forces GLIBC to use the <command>ranlib</command> utility
          we made for our target architecture.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="dg5">
        <term><parameter>--disable-profile</parameter></term>
        <listitem>
          <para>This builds the libraries without profiling information. 
          Omit this option if profiling on the temporary tools is necessary.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="dg6">
        <term><parameter>--with-tls</parameter></term>
        <listitem>
          <para>This tells GLIBC to use Thread Local Storage.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="dg7">
        <term><parameter>--enable-kernel=2.6.32</parameter></term>
        <listitem>
          <para>This tells GLIBC to compile the library with support
          for 2.6.32 and later Linux kernels.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="dg8">
        <term><parameter>--with-__thread</parameter></term>
        <listitem>
          <para>This tells GLIBC to use use the __thread for libc and
          libpthread builds.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="dg9">
        <term><parameter>--with-binutils=/cross-tools/bin</parameter></term>
        <listitem>
          <para>This tells GLIBC to use the Binutils that are specific to
          our target architecture.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="dg10">
        <term><parameter>--with-headers=/tools/include</parameter></term>
        <listitem>
          <para>This tells GLIBC to compile itself against the headers
          recently installed to the <filename class="directory">/tools</filename>
          directory, so that it knows exactly what features the kernel has
          and can optimize itself accordingly.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="dg11">
        <term><parameter>--enable-obsolete-rpc</parameter></term>
        <listitem>
          <para>This tells GLIBC to install rpc headers that are not installed
          by default but may be needed by other packages.</para>
        </listitem>
      </varlistentry>

      <varlistentry os="dg12">
        <term><parameter>--cache-file=config.cache</parameter></term>
        <listitem>
          <para>This tells GLIBC to utilize a premade cache file.</para>
        </listitem>
      </varlistentry>

    </variablelist>

    <para os="dh">During this stage the following warning might appear:</para>

<blockquote os="di"><screen><computeroutput>configure: WARNING:
*** These auxiliary programs are missing or
*** incompatible versions: msgfmt
*** some features will be disabled.
*** Check the INSTALL file for required versions.</computeroutput></screen></blockquote>

    <para os="dj">The missing or incompatible <command>msgfmt</command> program is
    generally harmless. This <command>msgfmt</command> program is part of the
    Gettext package which the host distribution should provide.</para>

    <para os="dk">Compile the package:</para>

<screen os="dl"><userinput>make</userinput></screen>

    <para os="dm">Install the package:</para>

<screen os="dn"><userinput>make install</userinput></screen>

  </sect2>

  <sect2 role="content">
    <title/>

    <para>Details on this package are located in <xref
    linkend="contents-glibc" role="."/></para>

  </sect2>

</sect1>
