Installing Glibc-2.3.1

Estimated build time:           To Be Determined
Estimated required disk space:  To Be Determined

Contents of Glibc

Last checked against version 2.2.5.

Glibc is the C library that provides the system calls and basic functions such as open, malloc, printf, etc. The C library is used by all dynamically linked programs.

Glibc installs the following files:

Program Files

catchsegv, gencat, getconf, getent, glibcbug, iconv, iconvconfig, ldconfig, ldd, lddlibc4, locale, localedef, mtrace, nscd, nscd_nischeck, pcprofiledump, pt_chown, rpcgen, rpcinfo, sln, sprof, tzselect, xtrace, zdump and zic

Library Files

ld.so, libBrokenLocale.[a,so], libSegFault.so, libanl.[a,so], libbsd-compat.a, libc.[a,so], libc_nonshared.a, libcrypt.[a,so], libdl.[a,so], libg.a, libieee.a, libm.[a,so], libmcheck.a, libmemusage.so, libnsl.a, libnss_compat.so, libnss_dns.so, libnss_files.so, libnss_hesiod.so, libnss_nis.so, libnss_nisplus.so, libpcprofile.so, libpthread.[a,so], libresolv.[a,so], librpcsvc.a, librt.[a,so], libthread_db.so and libutil.[a,so]

 

Glibc Installation Dependencies

Last checked against version 2.2.5.

Bash: sh
Binutils: ar, as, ld, ranlib, readelf
Diffutils: cmp
Fileutils: chmod, cp, install, ln, mknod, mv, mkdir, rm, touch
Gcc: cc, cc1, collect2, cpp, gcc
Grep: egrep, grep
Gzip: gzip
Make: make
Gawk: gawk
Sed: sed
Sh-utils: date, expr, hostname, pwd, uname
Texinfo: install-info, makeinfo
Textutils: cat, cut, sort, tr

 

Installation of Glibc

At the beginning of this chapter you installed Glibc and applied a patch to it. Part of this patch was undoing some changes to make static binaries compiled against Glibc-2.2 work. However, this is not what the Glibc developers intended and we don't need to keep this modified Glibc around. So we reinstall Glibc here to remove this patch.

A second reason to install Glibc again is because it's considered cleaner. The first Glibc was installed using programs compiled on your host distribution which sometimes has the effect of tainting Glibc. While this isn't a problem with the other packages compiled early in this chapter, for Glibc we want to be sure it's 100% OK (although feel free to reinstall other packages at this point so you can say you compiled an LFS system with LFS. Much like GCC's bootstrap installation method).

We'll also install the linuxthreads man pages here. As you may recall, during the first installation of Glibc this wasn't possible because Perl wasn't installed yet. Now that everything needed to install the Glibc linuxthreads man pages is present as well, we will install those too.

Before starting to install Glibc, you must cd into the glibc-2.3.1 directory and unpack glibc-linuxthreads inside the glibc-2.3.1 directory, not in /usr/src as you normally would do.

This package is known to behave badly when you have changed its default optimization flags (including the -march and -mcpu options). Therefore, if you have defined any environment variables that override default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting or modifying them when building Glibc. You have been warned.

Basically, compiling Glibc in any other way than the book suggests is putting your system at very high risk.

It is recommended by the Glibc installation documentation to build Glibc outside of the source tree. Create the build directory:

mkdir ../glibc-build &&
cd ../glibc-build

Next, prepare Glibc to be compiled:

../glibc-2.3.1/configure --prefix=/usr --disable-profile \
    --enable-add-ons --libexecdir=/usr/bin

Continue with compiling the package:

make

Begin package installation:

make install

Build the linuxthreads man pages:

make -C ../glibc-2.3.1/linuxthreads/man

Install the man pages:

make -C ../glibc-2.3.1/linuxthreads/man install

Complete package installation by relaunching bash:

exec /bin/bash --login