5.10. Glibc-2.4 64-Bit

#### Cross-Compiled Linux From Scratch - Version 1.0.0rc1-PowerPC64-Multilib

### Chapter 5. Constructing Cross-Compile Tools

- Prev

  Glibc-2.4 32 Bit

- Next

  GCC-4.1.1 - Cross Compiler Final

- Up.
- Home

# 5.10. Glibc-2.4 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.10.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.

Disable linking to `libgcc_eh`:

    patch -Np1 -i ../glibc-2.4-libgcc_eh-1.patch

The following patch fixes an issue that can cause localdef to segfault:

    patch -Np1 -i ../glibc-2.4-localedef_segfault-1.patch

The following sed fixes a build issue with Glibc. This will prevent nscd from trying to link to libraries that don't exist:

    cp -v nscd/Makefile{,.orig}
    sed -e "/nscd_stat.o: sysincludes = # nothing/d" nscd/Makefile.orig > \
        nscd/Makefile

Repeat the sed to fix `procfs.h`.

    cp -v sysdeps/unix/sysv/linux/powerpc/sys/procfs.h{,.orig}
    sed 's/__PPC64_ELF_H/__powerpc64__/' \
        sysdeps/unix/sysv/linux/powerpc/sys/procfs.h.orig \
        > sysdeps/unix/sysv/linux/powerpc/sys/procfs.h

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

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

    echo "slibdir=/tools/lib64" >> configparms

Prepare Glibc for compilation:

    BUILD_CC="gcc" CC="${LFS_TARGET}-gcc ${BUILD64}" \
        AR="${LFS_TARGET}-ar" RANLIB="${LFS_TARGET}-ranlib" \
        ../glibc-2.4/configure --prefix=/tools \
        --host=${LFS_TARGET} --build=${LFS_HOST} --libdir=/tools/lib64 \
        --disable-profile --enable-add-ons \
        --with-tls --enable-kernel=2.6.0 --with-__thread \
        --with-binutils=/cross-tools/bin --with-headers=/tools/include \
        --cache-file=config.cache

The meaning of the new configure options:

`CC="${LFS_TARGET}-gcc ${BUILD64}"`

  Forces Glibc to utilize 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.

Compile the package:

    make

Install the package:

    make install

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

- Prev

  Glibc-2.4 32 Bit

- Next

  GCC-4.1.1 - Cross Compiler Final

- Up.
- Home.