5.13. Glibc-2.25 32 Bit

The Glibc 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.13.1. Installation of Glibc

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.

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

mkdir -v ../glibc-build
cd ../glibc-build

Prepare Glibc for compilation:

BUILD_CC="gcc" CC="${CLFS_TARGET}-gcc ${BUILD32}" \
AR="${CLFS_TARGET}-ar" RANLIB="${CLFS_TARGET}-ranlib" \
../glibc-2.25/configure \
    --prefix=/tools \
    --host=${CLFS_TARGET32} \
    --build=${CLFS_HOST} \
    --enable-kernel=3.12.0 \
    --with-binutils=/cross-tools/bin \
    --with-headers=/tools/include \
    --enable-obsolete-rpc

The meaning of the new configure options:

BUILD_CC="gcc"

This sets Glibc to use the current compiler on our system. This is used to create the tools Glibc uses during its build.

CC="${CLFS_TARGET}-gcc ${BUILD32}"

Forces Glibc to utilize our target architecture GCC utilizing the 32 Bit flags.

AR="${CLFS_TARGET}-ar"

This forces Glibc to use the ar utility we made for our target architecture.

RANLIB="${CLFS_TARGET}-ranlib"

This forces Glibc to use the ranlib utility we made for our target architecture.

--enable-kernel=3.12.0

This tells Glibc to compile the library with support for 3.12.0 and later Linux kernels.

--with-binutils=/cross-tools/bin

This tells Glibc to use the Binutils that are specific to our target architecture.

--with-headers=/tools/include

This tells Glibc 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.

--enable-obsolete-rpc

This tells Glibc to install rpc headers that are not installed by default but may be needed by other packages.

During this stage the following warning might appear:

configure: WARNING:
*** These auxiliary programs are missing or
*** incompatible versions: msgfmt
*** some features will be disabled.
*** Check the INSTALL file for required versions.

The missing or incompatible msgfmt program is generally harmless. This msgfmt program is part of the Gettext package which the host distribution should provide. You might also see a similar (also harmless) message about missing autoconf.

Compile the package:

make

Install the package:

make install

Details on this package are located in Section 10.9.5, “Contents of Glibc.”