5.14. Glibc-2.25 64-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.14.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

Add the following variables to config.cache so they are set properly:

cat > config.cache << "EOF"
libc_cv_forced_unwind=yes
libc_cv_c_cleanup=yes
libc_cv_sparc64_tls=yes
libc_cv_gnu89_inline=yes
EOF

Configure Glibc to install its 64-bit libraries into /tools/lib64:

echo "libc_cv_slibdir=/tools/lib64" >> config.cache

Prepare Glibc for compilation:

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

The meaning of the new configure options:

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

Forces Glibc to build using our target architecture GCC utilizing the 64 Bit flags.

--libdir=/tools/lib64

Puts Glibc into /tools/lib64 instead of /tools/lib.

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.8.5, “Contents of Glibc.”