LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

FAQS
 FAQs
Apache FAQ
Linux FAQ
XML FAQ

Log in to particpate






   Linux FAQ > 6. Porting, Compiling and Obtaining Programs
Question:  6.6. How To Upgrade the Libraries without Trashing the System.
Answer:
Warning

Note: You should always have a rescue disk set ready when you perform this procedure, in the likely event that something goes wrong!

This procedure is especially difficult if you're upgrading very old libraries like libc4. But you should be able to keep libc4 on the same system with libc5 libraries for the programs that still need them. The same holds true for upgrading from libc5 to the newer-yet glibc2 libraries.

The problem with upgrading dynamic libraries is that, the moment you remove the old libraries, the utilities that you need to upgrade to the new version of the libraries don't work. There are ways around around this. One is to temporarily place a spare copy of the run time libraries, which are in /lib/, in /usr/lib/, or /usr/local/lib/, or another directory that is listed in the /etc/ld.so.conf file.

For example, when upgrading libc5 libraries, the files in /lib/ might look something like:

   libc.so.5
   libc.so.5.4.33
   libm.so.5
   libm.so.5.0.9


These are the C libraries and the math libraries. Copy them to another directory that is listed in /etc/ld.so.conf, like /usr/lib/:

   $ cp -df /lib/libc.so.5* /usr/lib/
   $ cp -df /lib/libm.so.5* /usr/lib/
   $ ldconfig


Be sure to run ldconfig to upgrade the library configuration.

The files libc.so.5 and libm.so.5 are symbolic links to the actual library files. When you upgrade, the new links will not be created if the old links are still there, unless you use the -f flag with cp. The -d flag to cp will copy the symbolic link itself, and not the file it points to.

If you need to overwrite the link to the library directly, use the -f flag with ln.

For example, to copy new libraries over the old ones, try this. Make a symbolic link to the new libraries first, then copy both the libraries and the links to /lib/, with the following commands.

   $ ln -sf ./libm.so.5.0.48 libm.so.5
   $ ln -sf ./libc.so.5.0.48 libc.so.5
   $ cp -df libm.so.5* /lib
   $ cp -df libc.so.5* /lib


Again, remember to run ldconfig after you copy the libraries.

If you are satisfied that everything is working correctly, you can remove the temporary copies of the old libraries from /usr/lib/ or wherever you copied them.


This FAQ is from Linux Frequently Asked Questions with Answers, maintained by Robert Kiesling

Sponsored by: