日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

Ubuntu 22.04 源碼安裝 openssl 1.1 error while loading shared libraries: libssl.so.1.1: cannot open share

作者:不霽何虹丶 更新時間: 2022-09-26 編程語言

libssl.so.1.1: cannot open shared object file

使用 Ubuntu 22.04 時,有時候會遇到如下錯誤

error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

這是因為Ubuntu 22.04 默認使用的是 openssl3.0 ,但是大多為 Ubuntu 生成的可執行文件依賴 openssl 1.1

安裝Openssl 1.1

我們可以采取源碼安裝的方式解決這個問題

下載源碼包并解壓

首先確定已經安裝下載工具

apt install -y wget 

隨后執行下載操作

wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz

對下載的文件解壓并進入到文件夾中

tar xvf openssl-1.1.1q.tar.gz && cd openssl-1.1.1q

安裝 GCC、Perl、Make

首先確保 Ubuntu 22.04 已經安裝 GCC Perl Make工具
如果你不知道這幾樣是什么,那么請執行安裝命令

sudo apt install -y perl gcc make

執行 config 配置

在成功安裝上述工具后執行 config命令

./config

如果一切正常應出現下方提示:

Operating system: x86_64-whatever-linux2
Configuring OpenSSL version 1.1.1q (0x1010111fL) for linux-x86_64
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL file first)         ***
***                                                                ***
**********************************************************************

編譯

隨后執行 make

make 

等待編譯成功后將出現類似如下提示:

${LDCMD:-gcc} -pthread -m64 -Wa,--noexecstack -Wall -O3 -L.   \
        -o test/x509_dup_cert_test test/x509_dup_cert_test.o \
         test/libtestutil.a -lcrypto -ldl -pthread
rm -f test/x509_internal_test
${LDCMD:-gcc} -pthread -m64 -Wa,--noexecstack -Wall -O3 -L.   \
        -o test/x509_internal_test test/x509_internal_test.o \
         test/libtestutil.a libcrypto.a -ldl -pthread
rm -f test/x509_time_test
${LDCMD:-gcc} -pthread -m64 -Wa,--noexecstack -Wall -O3 -L.   \
        -o test/x509_time_test test/x509_time_test.o \
         test/libtestutil.a -lcrypto -ldl -pthread
rm -f test/x509aux
${LDCMD:-gcc} -pthread -m64 -Wa,--noexecstack -Wall -O3 -L.   \
        -o test/x509aux test/x509aux.o \
         test/libtestutil.a -lcrypto -ldl -pthread
make[1]: Leaving directory '/root/openssl-1.1.1q'

安裝

這時 openssl1.1 就已經編譯好了,我們還需要將動態庫放入 /usr/local/lib中,執行 make install 即可

sudo make install 

執行成功后將出現類似以下提示:

/usr/local/share/doc/openssl/html/man7/crypto.html
/usr/local/share/doc/openssl/html/man7/ct.html
/usr/local/share/doc/openssl/html/man7/des_modes.html
/usr/local/share/doc/openssl/html/man7/Ed25519.html
/usr/local/share/doc/openssl/html/man7/Ed448.html -> /usr/local/share/doc/openssl/html/man7/Ed25519.html
/usr/local/share/doc/openssl/html/man7/evp.html
/usr/local/share/doc/openssl/html/man7/ossl_store-file.html
/usr/local/share/doc/openssl/html/man7/ossl_store.html
/usr/local/share/doc/openssl/html/man7/passphrase-encoding.html
/usr/local/share/doc/openssl/html/man7/proxy-certificates.html
/usr/local/share/doc/openssl/html/man7/RAND.html
/usr/local/share/doc/openssl/html/man7/RAND_DRBG.html
/usr/local/share/doc/openssl/html/man7/RSA-PSS.html
/usr/local/share/doc/openssl/html/man7/scrypt.html
/usr/local/share/doc/openssl/html/man7/SM2.html
/usr/local/share/doc/openssl/html/man7/ssl.html
/usr/local/share/doc/openssl/html/man7/X25519.html
/usr/local/share/doc/openssl/html/man7/X448.html -> /usr/local/share/doc/openssl/html/man7/X25519.html
/usr/local/share/doc/openssl/html/man7/x509.html

設置環境變量并生效

有些可執行文件讀取的動態鏈接庫的路徑不同,這里最好設置一下動態鏈接庫的環境變量

sudo echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib" >> /etc/profile

執行 source /etc/profile 使其在當前客戶端生效

source /etc/profile

這樣就成功解決了這個問題

原文鏈接:https://blog.csdn.net/qq_43666528/article/details/127041263

欄目分類
最近更新