6.17. Installing Zlib-1.1.4

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

6.17.1. Contents of Zlib

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

Installed libraries: libz[a,so]

6.17.2.

6.17.3. Zlib Installation Dependencies

Zlib depends on: Binutils, Coreutils, GCC, Glibc, Make, Sed.

6.17.4.

6.17.5. 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 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 test suite 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