# EGLIBC-&eglibc-version; Headers

## Installation of EGLIBC Headers

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

    cat > config.cache << "EOF"
    libc_cv_forced_unwind=yes
    libc_cv_c_cleanup=yes
    libc_cv_mlong_double_128=yes
    libc_cv_alpha_tls=yes
    libc_cv_gnu89_inline=yes
    libc_cv_ssp=no
    EOF

    CC=gcc ../eglibc-&eglibc-version;/configure --prefix=/tools \
       --host=${CLFS_TARGET} --build=${CLFS_HOST} \
       --disable-sanity-checks --enable-kernel=2.6.0 \
       --with-headers=/tools/include --cache-file=config.cache \
       --with-binutils=/cross-tools/${CLFS_TARGET}/bin

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

## The meaning of the configure options:

`CC=gcc`

- Tells EGLIBC to use the host's GCC compiler.

`--prefix=/tools`

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

`--build=${CLFS_HOST}`

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

`--host=${CLFS_TARGET}`

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

`--disable-sanity-checks`

- This switch disables any checks that are in place.

`--enable-kernel=2.6.0`

- This tells EGLIBC to compile the library with support for 2.6.x Linux kernels.

`--with-headers=/tools/include`

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

`--with-binutils=/cross-tools/${CLFS_TARGET}/bin`

- 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-&eglibc-version;/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h \
        /tools/include/bits/

Details on this package are located in contents-eglibc