6.15. Zlib-1.2.3

The Zlib package contains compression and decompression routines used by some programs.

User Notes: http://wiki.linuxfromscratch.org/hlfs/wiki/zlib

6.15.1. Installation of Zlib

[Note]

Note

Zlib is known to build its shared library incorrectly if CFLAGS is specified in the environment. If using a specified CFLAGS variable, be sure to add the -fPIC directive to the CFLAGS variable for the duration of the configure command below, then remove it afterwards. This is only an issue if you did not add the ASLR (-fPIC) modification to GCC specs.

We can add compiler warnings to Zlib:

sed '0,/^# udpate Makefile/s//CFLAGS="$CFLAGS \\\
    -Wall -Wformat-security -Wwrite-strings -Wpointer-arith \\\
    -Wstrict-prototypes -Wmissing-prototypes -Werror -Wfatal-errors"\n&/' \
    -i.orig configure

Prepare Zlib for compilation:

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

Compile the package:

make

To test the results, issue: make check.

Install the shared library:

make install

The previous command installed symbolic link in /lib. We will remove it and relink it into /usr/lib:

rm -v /lib/libz.so
ln -vsf ../../lib/libz.so.1.2.3 /usr/lib/libz.so

6.15.2. Contents of Zlib

Installed libraries: libz.so

Short Descriptions

libz

Contains compression and decompression functions used by some programs