在使用源码安装完 openssl 后,执行 openssl version 命令查看版本信息时,报如下错误:
root@BZD25521:/etc/ld.so.conf.d# openssl version
openssl: symbol lookup error: openssl: undefined symbol: EVP_mdc2, version OPENSSL_1_1_0
报错原因
缺少动态库
解决办法
方案一:
在指定安装路径时使用 -fPIC 参数链接动态库
# 将 /usr/local/openssl 替换为你自己的 openssl 安装路径
./config --prefix=/usr/local/openssl -fPIC
方案二:
1)手动链接动态库
cd /etc/ld.so.conf.d/
vim openssl-1.1.1w.conf
# 文件中添加库路径,将 /usr/local/openssl/lib 替换为你自己的 openssl 安装路径
/usr/local/openssl/lib
# 保存退出
2)重新加载动态链接
ldconfig -v
重新查看版本信息
root@BZD25521:/etc/ld.so.conf.d# openssl version
OpenSSL 1.1.1w 11 Sep 2023
openssl 安装教程见:Ubuntu(WSL)卸载与安装指定版本的 openssl-CSDN博客