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 (usually libXXX.so) are loaded into memory from the shared copy at runtime (hence the name). Static libraries (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 README or 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 we list these and some others and explain why you may want to install them.
The PCRE package contains Perl Compatible Regular Expression libraries. These are useful for implementing regular expression pattern matching using the same syntax and semantics as Perl 5.
Download (FTP): ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-6.7.tar.bz2
Download MD5 sum: dbbec9d178ce199e67e98c9a4f994f90
Download size: 564 KB
Estimated disk space required: 8.9 MB
Estimated build time: 0.2 SBU
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/pcre
Install PCRE by running the following commands:
./configure --prefix=/usr --enable-utf8 && make
To test the results, issue: make runtest.
Now, as the root user:
make install && install -v -m755 -d /usr/share/doc/pcre-6.7/html && install -v -m644 doc/html/* /usr/share/doc/pcre-6.7/html && install -v -m644 doc/{Tech.Notes,*.txt} /usr/share/doc/pcre-6.7
If you reinstall Grep after installing PCRE, Grep will get linked against PCRE and may cause problems if /usr is a separate mount point. To avoid this, either pass the option --disable-perl-regexp when executing ./configure for Grep or move libpcre to /lib as follows.
mv -v /usr/lib/libpcre.so.* /lib/ && ln -v -sf ../../lib/libpcre.so.0 /usr/lib/libpcre.so
--enable-utf8: This switch includes the code for handling UTF-8 character strings in the library.
Last updated on 2006-09-10 14:32:34 -0500