After installing openssl from the source code, when executing the openssl version command to view the version information, the following error is reported:
root@BZD25521:/etc/ld.so.conf.d# openssl version
openssl: symbol lookup error: openssl: undefined symbol: EVP_mdc2, version OPENSSL_1_1_0
Reason for error
Missing dynamic library
Solution
Option One:
Use the -fPIC parameter to link the dynamic library when specifying the installation path
# 将 /usr/local/openssl 替换为你自己的 openssl 安装路径
./config --prefix=/usr/local/openssl -fPIC
Option II:
1) Manually link dynamic libraries
cd /etc/ld.so.conf.d/
vim openssl-1.1.1w.conf
# 文件中添加库路径,将 /usr/local/openssl/lib 替换为你自己的 openssl 安装路径
/usr/local/openssl/lib
# 保存退出
2) Reload dynamic links
ldconfig -v
Check version information again
root@BZD25521:/etc/ld.so.conf.d# openssl version
OpenSSL 1.1.1w 11 Sep 2023
For openssl installation tutorial, see:Ubuntu (WSL) uninstalling and installing the specified version of openssl-CSDN blog