The Zlib package contains compression and decompression routines used by some programs.
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