Details on this package are located in Section 10.8.5, “Contents of Glibc.”
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.
The following sed removes a dependency of gcc 3.4.x from the glibc we are using in cross-lfs. The reason we are changing it is because this only installs the headers, no compiling takes place. In the next Glibc installation, we use the GCC that's built right after this section:
cp -v configure{,.orig} sed -e 's/3.4/3.[0-9]/g' configure.orig > configure
The Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory:
mkdir -v ../glibc-build cd ../glibc-build
The following lines need to be added to config.cache for Glibc to support NPTL:
echo "libc_cv_forced_unwind=yes" > config.cache echo "libc_cv_c_cleanup=yes" >> config.cache echo "libc_cv_ppc_machine=yes" >> config.cache
We need to persuade configure that the host's compiler has all the necessary modern powerpc64 extensions. It will still pass flags such as -mnew-abi which are likely to trigger error messages on a non-ppc host, but the headers can be built. We do this by adding the following lines to config.cache. Note that one of these has three consecutive underscores.
echo "libc_cv_mlong_double_128ibm=yes" >> config.cache echo "libc_cv_mlong_double_128=yes" >> config.cache echo "libc_cv_powerpc64_tls=yes" >> config.cache echo "libc_cv_initfini_array=yes" >>config.cache echo "libc_cv_gcc___thread=yes" >>config.cache
Prepare Glibc for compilation:
CC=gcc ../glibc-2.4/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:
Tells Glibc 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 Glibc to compile the library with support for 2.6.x Linux kernels.
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.
This tells Glibc 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 ../glibc-2.4/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h /tools/include/bits/
Details on this package are located in Section 10.8.5, “Contents of Glibc.”