欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

undefined reference to `BIO_f_zlib‘ openssl编译报错

程序员文章站 2022-03-04 23:51:46
...

undefined reference to `BIO_f_zlib’

问题描述

openssl升级过程中的编译时报错

enc.c:(.text+0xdec): undefined reference to `BIO_f_zlib'
collect2: error: ld returned 1 exit status
make[1]: *** [apps/openssl] Error 1
make[1]: Leaving directory `/usr/local/src/openssl-1.1.1h'
make: *** [all] Error 2

undefined reference to `BIO_f_zlib‘ openssl编译报错

解决方案

make clean
make //重新编译
undefined reference to `BIO_f_zlib‘ openssl编译报错

openssl 升级至 openssl-1.1.1h 过程


1.下载指定版本的openssl软件
在下面网址:https://www.openssl.org/source/下载 后面的版本号可以换
[aaa@qq.com ~]# wget hhttps://www.openssl.org/source/openssl-1.1.1h.tar.gz

2.编译安装
tar xfz /tmp/openssl-1.1.1e.tar.gz -C /opt/ && cd /opt/openssl-1.1.1h/
./config shared zlib
make && make install

3.配置
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak	# 如报mv: cannot stat ‘/usr/include/openssl’: No such file or directory可忽略此步
find / -name openssl
ln -s /usr/local/bin/openssl /usr/bin/openssl
ln -s /usr/local/include/openssl /usr/include/openssl
echo "/usr/local/lib64/" >> /etc/ld.so.conf
ldconfig 
openssl version -a

4.验证
openssl version 

undefined reference to `BIO_f_zlib‘ openssl编译报错
升级过程中可能会出现缺少zlib.h文件
故附zlib源码安装步骤

1、zlib源码包下载
zlib地址:http://www.zlib.net/

2、zlib标准编译、安装指导:

将包手动上传至/tmp目录下
mv /tmp/zlib-1.2.11.tar.gz /usr/local/src/ && cd /usr/local/src/ && tar zxf zlib-1.2.11.tar.gz && cd zlib-1.2.11
cd /usr/local/src/zlib-1.2.11

构建静态库
.../zlib-1.2.11]# ./configure
.../zlib-1.2.11]# make test
.../zlib-1.2.11]# make install

构建共享库
.../zlib-1.2.11]# make clean
.../zlib-1.2.11]# ./configure --shared
.../zlib-1.2.11]# make test
.../zlib-1.2.11]# make install
.../zlib-1.2.11]# cp zutil.h /usr/local/include
.../zlib-1.2.11]# cp zutil.c /usr/local/include