Linux From Scratch: Version 5.0-pre1
Prev | Chapter 6. Installing basic system software | Next

# Installing Zlib-1.1.4

    Estimated build time:           0.1 SBU
    Estimated required disk space:  1 MB

## Contents of Zlib

(Last checked against version 1.1.4.)

The Zlib package contains the zlib library, which is used by many programs for its compression and uncompression functions.

Zlib installs the following:

### Library Files

libz[a,so]

##

## Zlib Installation Dependencies

(No dependencies checked yet.)

##

## Installation of Zlib

Zlib has a potential buffer overflow in its gzprintf() function, that, though difficult to take advantage of, should be taken care of. Do so by applying this patch:

    patch -Np1 -i ../zlib-1.1.4-vsnprintf.patch

Now prepare Zlib for compilation:

    ./configure --prefix=/usr --shared

Note: Zlib is known to build its shared library incorrectly if a CFLAGS is specified in the environment. If you are using your own CFLAGS variables, ensure you add the -fPIC directive during this stage, and remove it afterwards.

Compile the package:

    make

Install the shared libraries:

    make install

Now also build the non-shared libraries:

    make clean
    ./configure --prefix=/usr
    make

This package has a testsuite available which can perform a number of checks to ensure it built correctly. Should you choose to run it, the following command will do so:

    make test

And install the package:

    make install

The shared Zlib library should be installed in the `/lib` directory. That way, in the event that you must boot without the `/usr` directory, vital system programs will still have access to the library:

    mv /usr/lib/libz.so.* /lib

The `/usr/lib/libz.so` symlink is linked to a file which no longer exists, because we moved it. Create a symbolic link to the new location of the library:

    ln -sf ../../lib/libz.so.1 /usr/lib/libz.so

Zlib does not install its manual page. Issue the following command to install this documentation:

    cp zlib.3 /usr/share/man/man3

Prev | Home | Next
Installing Coreutils-5.0 | Up | Installing Lfs-Utils-0.3