
Linux From Scratch - Version 7.0
40
5.7. Glibc-2.14.1
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.
Approximate build time: 5.5 SBU
Required disk space: 501 MB
5.7.1. Installation of Glibc
Fix a bug that prevents Glibc from building with GCC-4.6.1:
patch -Np1 -i ../glibc-2.14.1-gcc_fix-1.patch
Also address a header check that fails due to an incomplete build environment at this point:
patch -Np1 -i ../glibc-2.14.1-cpuid-1.patch
The Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory:
mkdir -v ../glibc-build
cd ../glibc-build
Because Glibc no longer supports i386, its developers say to use the compiler flag -march=i486 when building it
for x86 machines. There are several ways to accomplish that, but testing shows that the flag is best placed inside the
build variable “CFLAGS”. Instead of overriding completely what Glibc's internal build system uses for CFLAGS,
append the new flag to the existing contents of CFLAGS by making use of the special file configparms. The -
mtune=native flag is also necessary to reset a reasonable value for -mtune that is changed when setting -march.
case `uname -m` in
i?86) echo "CFLAGS += -march=i486 -mtune=native" > configparms ;;
esac
Next, prepare Glibc for compilation:
../glibc-2.14.1/configure --prefix=/tools \
--host=$LFS_TGT --build=$(../glibc-2.14.1/scripts/config.guess) \
--disable-profile --enable-add-ons \
--enable-kernel=2.6.25 --with-headers=/tools/include \
libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes
The meaning of the configure options:
--host=$LFS_TGT, --build=$(../glibc-2.14.1/scripts/config.guess)
The combined effect of these switches is that Glibc's build system configures itself to cross-compile, using the
cross-linker and cross-compiler in /tools.
--disable-profile
This builds the libraries without profiling information. Omit this option if profiling on the temporary tools is
necessary.
--enable-add-ons
This tells Glibc to use the NPTL add-on as its threading library.
Kommentare zu diesen Handbüchern