This is the sixth step in installing glibc-2. Here we upgrade our main libc to the last version. Though you do not need to do this to be able to use glibc-2, it is still sensible to upgrade your libc-5 if it is old.
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 file. The newest version as of the writing of this document is libc-5.4.46; installation of newer versions may differ, and some of the patches may not apply cleanly. Please use at least 5.4.46, as there are some complications for earlier versions.
You do not need to apply the patches in README.distributors, if you are using a 2.x kernel.
Installing the C-library is potentially dangerous. If something would go really wrong (fortunately, that is not very likely), you could be left with a system that can not run anything. It is sensible to check you have a set of rescue disks somewhere that you can use to boot the system with if everything else fails.
You should apply at least the first of these patches if you run a 2.2.x kernel.
- Make compilation with 2.2 kernels possible
In one of the system-dependent files, a few more headerfiles need to be included than for 2.0 kernels.
- (Optional) Create relative links
This patch forces the creation of relative links between directories, which makes installing in a temporary directory possible and is generally much cleaner.
You can apply these patches by entering the gcc directory and using the following command:
patch -p1 -E < filename
Compiling and installing libc5
I will assume you use bash as shell; if not, some commands may slightly differ. I will explain each step.
You will be asked whether you agree with the suggested setup. You can safely do so. Check that the right target is choosen (i486-linux-libc5).
Clean up the source tree.
This makes all depend files and compiles the source.
This installs the library and the include files. Remember you must be root to do this. If you want to know what will be installed, you can add TARGET_ROOTDIR=/tmp to install the compiler at a temporary location (you must have applied the second patch for this to work). Do not forget to do a proper installation afterwards!
Create all necessary symbolic links and update the shared libary cache. You must be root to do this.
Checking the installation
Check to see whether the new version of libc is installed: ldconfig -v | grep libc.so.5. It should output:
libc.so.5 => libc.so.5.4.46
Next you should try to run a program that is dynamically linked against the C-library:
If this works, try to compile a simple program, and to run it. If that also works, everything should be all right.
You can find a manifest of the installed files below.
What to do if everything fails
If something went hideously wrong, you probably can't run any programs anymore. Do not log out! Fortunately, in almost every distribution there is a program sln that is statically linked and creates symbolic links. Even if ls does not work anymore, you can still use echo *. Go to /lib and look for a file libc-5.?.?. Now try this command:
sln libc-5.?.? libc-5
Substitute the version you found for the question marks. With a little luck, everything should work again. If this does not help, you will have to use a rescue disk to boot with and correct the problem...