Installing Glibc

Installation of Glibc

Unpack the glibc-linuxthreads in the glibc-2.2.1 directory, not in /usr/src.

Install Glibc by running the following commands:



mknod -m 0666 /dev/null c 1 3 &&
touch /etc/ld.so.conf &&
mkdir /usr/src/glibc-build &&
cd /usr/src/glibc-build &&
sed s/"\$(PERL)"/"\/usr\/bin\/perl"/ \
���../glibc-2.2.1/malloc/Makefile > tmp~ &&
mv tmp~ ../glibc-2.2.1/malloc/Makefile &&
sed "s/root/0/" ../glibc-2.2.1/login/Makefile > tmp~ &&
mv tmp~ ../glibc-2.2.1/login/Makefile &&
../glibc-2.2.1/configure \
���--prefix=/usr --enable-add-ons \
���--libexecdir=/usr/bin &&
sed s/"cross-compiling = yes"/"cross-compiling = no"/ \
���config.make > config.make~ &&
mv config.make~ config.make &&
make &&
make install &&
make localedata/install-locales

By exiting the chroot'ed environment and re-entering it, you will be able to get rid of the "I have no name!" message in the command prompt, which is caused by bash's inability to resolve a userid to a username. You don't have to exit and re-enter chroot, but it's highly recommended to ensure a properly working bash.

Run the following commands to accomplish this:



logout
chroot $LFS /usr/bin/env -i HOME=/root \
���TERM=$TERM /bin/bash --login
 

Command explanations

mknod -m 0666 /dev/null c 1 3: Glibc needs a null device to compile properly. All other devices will be created in the next section.

touch /etc/ld.so.conf One of the final steps of the Glibc installation is running ldconfig to update the dynamic loader cache. If this file isn't present Glibc will abort with an error that it can't read the file. So we create an empty file for it (the empty file will have Glibc default to using /lib and /usr/lib which is fine right now).

--enable-add-ons: This enables the add-on that we install with Glibc: linuxthreads

Contents

The Glibc package contains the GNU C Library.

Description

The C Library is a collection of commonly used functions in programs. This way a programmer doesn't need to create his own functions for every single task. The most common things like writing a string to the screen are already present and at the disposal of the programmer.

The C library (actually almost every library) come in two flavors: dynamic ones and static ones. In short when a program uses a static C library, the code from the C library will be copied into the executable file. When a program uses a dynamic library, that executable will not contain the code from the C library, but instead a routine that loads the functions from the library at the time the program is run. This means a significant decrease in the file size of a program. The documentation that comes with the C Library describes this in more detail, as it is too complicated to explain here in one or two lines.