glibc-2.2 installation instructions

Bruno Haible, <bruno@clisp.org>

v0.1, 28 October 2000


This document describes how to install a glibc-2.2 prerelease or release.

1. Disclaimer

Installing a glibc-2.2 prerelease or release replaces the C library every program on your system uses. Therefore it has some risks, in particular your Linux system may become nonfunctional. If you follow the instructions below, you shouldn't have any problems. It worked for me. If you encounter problems, please tell me, so I can update this document, but don't sue me. This documentation is provided "as is", without warranty of any kind, expressed or implied. In no event shall Bruno Haible or the GNU project be liable for any claim, damage or other liability, arising from the use of this documentation. If you don't have the courage, use the riskless installation instructions in glibc22snapshot-HOWTO.html.

2. What you need

Sources:
Programs:
not too old versions of gcc, make, sed.
Disk space:
ca. 100 MB permanent, ca. 700 MB temporary space.

3. General approach

Here is how to install a glibc snapshot in /lib:/usr/lib.

4. Step 0: Preparation

Work as the root user.

    $ su -

Unset the LD_PRELOAD and LD_LIBRARY_PATH environment variables. They would only cause trouble later.

    $ unset LD_PRELOAD
    $ unset LD_LIBRARY_PATH

Prepare the kernel sources. You must have them unpacked and configured. /usr/src/linux/include/linux/autoconf.h must exist. Building the kernel is not needed.

5. Step 1: Build glibc

Unpack a fresh copy of the glibc snapshot sources. (Building glibc needs write access to the sources.) Also, remove the CVS traces therein.

    $ tar xvfz /somewhere/glibc-2000-10-xx.tar.gz
    $ find glibc-2000-10-xx -name CVS -type d -exec rm -r '{}' ';'
Note that if you got the snapshot from the ftp site, you need to download and unpack two files: the main sources and the linuxthreads add-on.

Create a build directory and build there:

    $ mkdir glibc-build
    $ cd glibc-build
    $ ../glibc-2000-10-xx/configure --prefix=/usr --with-headers=/usr/src/linux/include --enable-add-ons

    $ make
    $ make check

Make the documentation:

    $ make info
    $ make dvi        [This creates manual/libc.dvi.]
    $ make pdf        [This creates manual/libc.pdf.]

Then install it:

    $ LC_ALL=C make install
    $ make localedata/install-locales

    $ mkdir -p /usr/doc/libc
    $ cp ../glibc-2000-07-xx/manual/libc.{dvi,pdf} /usr/doc/libc

6. Step 2: Update gcc

Some C++ include files in gcc-2.95.2 confuse the fpos_t and off_t types. They were identical in glibc-2.1 but fpos_t has changed in glibc-2.1.95. In order to build C++ programs, you need to fix this using a patch:

    $ cat gccinclude-glibc-2.2-compat.diff | (cd /usr/include/g++ && patch)