<?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-system-glibc" role="wrap">
  <?dbhtml filename="glibc.html"?>

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

  <indexterm zone="ch-system-glibc">
    <primary sortas="a-Glibc">Glibc</primary>
  </indexterm>

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

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

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

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

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

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

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

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

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

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

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

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

    <para os="l5">Tell Glibc to install its libraries into
    <filename class="directory">/lib</filename>:</para>

<screen os="l6"><userinput>echo "slibdir=/lib" &gt;&gt; configparms</userinput></screen>

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

<screen os="h"><userinput>../glibc-&glibc-version;/configure --prefix=/usr \
    --disable-profile --enable-kernel=2.6.32 \
    --libexecdir=/usr/lib/glibc --libdir=/usr/lib \
    --enable-obsolete-rpc</userinput></screen>

    <variablelist os="i">
      <title>The meaning of the new configure option:</title>

      <varlistentry>
        <term><parameter>--libexecdir=/usr/lib/glibc</parameter></term>
        <listitem>
          <para>This changes the location of the <command>getconf</command>
          utility from its default of <filename
          class="directory">/usr/libexec</filename> to <filename
          class="directory">/usr/lib/glibc</filename>.</para>
        </listitem>
      </varlistentry>
    </variablelist>

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

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

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

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

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="../multilib/glibc-64bit.xml"
    xpointer="xpointer(//*[@os='n'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="../multilib/glibc-64bit.xml"
    xpointer="xpointer(//*[@os='o'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="../multilib/glibc-64bit.xml"
    xpointer="xpointer(//*[@os='p'])"/>

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

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

    <para>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.</para>

    <screen><userinput>ln -sv &glibc-ld-name; /lib/ld-linux.so.2</userinput></screen>

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

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

    <para>Now we can remove this symlink.  We also need to correct the <command>
    /usr/bin/ldd</command> 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 <command>sed</command> will correct this:</para>

    <screen><userinput>rm -v /lib/ld-linux.so.2
sed -i.bak '/RTLDLIST/s%/ld-linux.so.2 /lib64%%' /usr/bin/ldd</userinput></screen>

    <para>Check the script to make sure the sed worked correctly, then delete
    the backup.</para>

    <screen><userinput>rm -v /usr/bin/ldd.bak</userinput></screen>

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

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

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

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

  </sect2>

  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
  href="../common/glibc.xml"
  xpointer="xpointer(id('i18n-glibc'))"/>

  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
  href="../common/glibc.xml"
  xpointer="xpointer(id('conf-glibc'))"/>

  <sect2 id="conf-ld" role="configuration">
    <title>Configuring The Dynamic Loader</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-x86-64.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>

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

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

  </sect2>

  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
  href="../common/glibc.xml"
  xpointer="xpointer(id('contents-glibc'))"/>

</sect1>
