Libraries contain code which is often required by more than one program. This has the advantage that each program doesn't need to duplicate code (and risk introducing bugs), it just has to call functions from the libraries installed on the system. The most obvious example of a set of libraries is Glibc which is installed during the LFS book. This contains all of the C library functions which programs use.
There are two types of libraries: static and shared. Shared libraries
libXXX.so) are loaded into
memory from the shared copy at runtime (hence the name). Static
libXXX.a ) are actually
linked into the program executable file itself, thus making the
program file larger. Quite often, you will find both static and
shared copies of the same library on your system.
Generally, you only need to install libraries when you are installing
software that needs the functionality they supply. In the BLFS book,
each package is presented with a list of (known) dependencies. Thus,
you can figure out which libraries you need to have before installing
that program. If you are installing something without using BLFS
instructions, usually the
INSTALL file will contain details of
the program's requirements.
There are certain libraries which nearly everyone will need at some point. In this chapter these and some others are listed and it is explained why you may want to install them.