Jump to Navigation



This is the fourth step in installing glibc-2. We now install the library itself. We can do this before we generate a cross-compiler, because the binary formats of libc-5 and libc-6 objects are the same; we must do this first because we need the header files before we can create the cross-compiler, and the header files are dynamically created.

Preparing for compilation

Even though this is a relative step-by-step guide, it would be wise to read the most important documentation yourself; especially the README and INSTALL files. The newest version as of the writing of this document is glibc-2.0.6; installation of newer versions may differ slightly.

Glibc comes in several packages. Unpack the main package first, cd into the newly created glibc directory and unpack all other packages there.

Compiling and installing libc6

I will assume you use bash as shell; if not, some commands may slightly differ. I will explain each step.

./configure i486-pc-linux-gnulibc1 \
--prefix=/usr/i486-linux-libc6 \

We tell glibc to create a library for i486-pc-linux-gnu, to install everything beneath /usr/i486-linux-libc6 instead of /usr/local, and that we use all add-on packages.

make datadir=/usr/i486-linux-libc6/lib

We now compile the library. If you do not specify the datadir argument, /usr/i486-linux-libc6/share will be used (I prefer things to get installed in lib directories, but your mileage may vary)

make install datadir=/usr/i486-linux-libc6/lib

Now we can install the library. Remember you must be root to do this. If you want to know what will be installed, you can add prefix=/tmp/usr/i486-linux-libc6 to install the compiler at a temporary location. You must also change the datadir argument. Do not forget to do a proper installation afterwards!

ln -sfn ../usr/i486-linux-libc6/lib/ld-linux.so.2 /lib/ld-linux.so.2

The dynamic linker is looked for in /lib, so we need this link.

rm -rf /usr/i486-linux-libc6/include/scsi
ln -sfn ../../src/linux/include/linux /usr/i486-linux-libc6/include/linux
ln -sfn ../../src/linux/include/scsi /usr/i486-linux-libc6/include/scsi
ln -sfn ../../src/linux/include/asm /usr/i486-linux-libc6/include/asm

Some programs need the kernel headers, so we need these links. We first remove the scsi directory created by glibc. Currently, there is only one file in it (sg.h), which is duplicated by the kernel distribution. I would rather keep the kernel version than the glibc version, so we remove the scsi directory first.

You can find a manifest of all installed files below.

Modifying ld.so.conf

In /etc/ld.so.conf all directories are listed in which the dynamic linker looks for libraries. Both the dynamic linker for libc-5 and the dynamic linker for glibc-2 use this file. You must add a line containing only /usr/i486-linux-libc6/lib to it, and run ldconfig as root after that. It is probably a good idea to add /usr/i486-linux-libc5/lib there too:


Historic_content | by Dr. Radut