【介绍】
参考:http://www.linuxfromscratch.org/lfs/view/stable/chapter06/zlib.html
【安装(yum)】
CentOS 8版本:
yum install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/zlib-1.2.11-10.el8.x86_64.rpm yum install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/zlib-devel-1.2.11-10.el8.x86_64.rpm
卸载原有版本:
rpm -e –nodeps zlib zlib-devel
【安装(编译)】
实证版本:zlib-1.2.8
参考:http://blog.csdn.net/aa1600159112/article/details/76664566
wget https://jaist.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz && tar -zxvf zlib-1.2.8.tar.gz && cd zlib-1.2.8 && ./configure --prefix=/usr && make && make check && make install && mv -v /usr/lib/libz.so.* /lib && ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so
最高版本:zlib-1.2.11
wget http://zlib.net/zlib-1.2.11.tar.gz && tar -zxvf zlib-1.2.11.tar.gz && cd zlib-1.2.11 ./configure --prefix=/usr make && make check && make install mv -v /usr/lib/libz.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so
相关文件路径:
Z_CFLAGS="-I/usr/include" Z_LIBS="-L/usr/lib -lz"
【排错】
报错:fatal error: zlib.h: no such file or directory
当编译 openssl 时,出现此报错。
参考:https://stackoverflow.com/questions/36374267/how-to-fix-fatal-error-zlib-h-no-such-file-or-directory
可以通过安装 libz-devel 解决:
yum install libz-devel