5.14. EGLIBC-2.15 Headers

The EGLIBC 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.

5.14.1. Installation of EGLIBC Headers

It should be noted that compiling EGLIBC in any way other than the method suggested in this book puts the stability of the system at risk.

ALPHA is not supported in the main EGLIBC tree, so we need the eglibc-ports tarball. Unpack eglibc-ports-2.15-r21467:

tar -xvf ../eglibc-ports-2.15-r21467.tar.xz

Disable linking to libgcc_eh:

cp -v Makeconfig{,.orig}
sed -e 's/-lgcc_eh//g' Makeconfig.orig > Makeconfig

EGLIBC's configure script checks the version of GCC, and will fail if it's less than 3.4. The next EGLIBC build will use the GCC that will be installed into /cross-tools in the next step. However, in this step only the EGLIBC headers are being installed - no compiling is taking place - so the GCC version isn't important. The following sed removes the dependency of GCC 3.4.x:

cp -v configure{,.orig}
sed -e 's/3.4/3.[0-9]/g' configure.orig > configure

The EGLIBC documentation recommends building EGLIBC outside of the source directory in a dedicated build directory:

mkdir -v ../eglibc-build
cd ../eglibc-build

The following lines need to be added to config.cache for EGLIBC to support NPTL:

cat > config.cache << "EOF"

Prepare EGLIBC for compilation:

CC=gcc ../eglibc-2.15/configure --prefix=/tools \
   --host=${CLFS_TARGET} --build=${CLFS_HOST} \
   --disable-sanity-checks --enable-kernel=2.6.32 \
   --with-headers=/tools/include --cache-file=config.cache \


Any error message you see about nptl at this point can safely be ignored.

The meaning of the configure options:


Tells EGLIBC to use the host's GCC compiler.


This tells the configure script to prepare to install the package in the /tools directory.


When used with --host, this creates a cross-architecture executable that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST}.


When used with --build, this creates a cross-architecture executable that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST}.


This switch disables any checks that are in place.


This tells EGLIBC to compile the library with support for 2.6.32 and later Linux kernels.


This tells EGLIBC to compile itself against the headers recently installed to the /tools directory, so that it knows exactly what features the kernel has and can optimize itself accordingly.


This tells EGLIBC to use the Binutils for our specific target architecture.

Now, install the headers:

make install-headers

Some files aren't installed by the above command, so we will copy the additional header files we need.

First we will copy a common file over to /tools/include:

install -dv /tools/include/bits
cp -v bits/stdio_lim.h /tools/include/bits

Now we will create a blank stub file:

touch /tools/include/gnu/stubs.h

Another header is needed for NPTL:

cp -v ../eglibc-2.15/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h \

Details on this package are located in Section 10.7.5, “Contents of EGLIBC.”