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

學(xué)無(wú)先后,達(dá)者為師

網(wǎng)站首頁(yè) 編程語(yǔ)言 正文

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

作者:不霽何虹丶 更新時(shí)間: 2022-09-26 編程語(yǔ)言

libssl.so.1.1: cannot open shared object file

使用 Ubuntu 22.04 時(shí),有時(shí)候會(huì)遇到如下錯(cuò)誤

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

這是因?yàn)閁buntu 22.04 默認(rèn)使用的是 openssl3.0 ,但是大多為 Ubuntu 生成的可執(zhí)行文件依賴 openssl 1.1

安裝Openssl 1.1

我們可以采取源碼安裝的方式解決這個(gè)問(wèn)題

下載源碼包并解壓

首先確定已經(jīng)安裝下載工具

apt install -y wget 

隨后執(zhí)行下載操作

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

對(duì)下載的文件解壓并進(jìn)入到文件夾中

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

安裝 GCC、Perl、Make

首先確保 Ubuntu 22.04 已經(jīng)安裝 GCC Perl Make工具
如果你不知道這幾樣是什么,那么請(qǐng)執(zhí)行安裝命令

sudo apt install -y perl gcc make

執(zhí)行 config 配置

在成功安裝上述工具后執(zhí)行 config命令

./config

如果一切正常應(yīng)出現(xiàn)下方提示:

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)         ***
***                                                                ***
**********************************************************************

編譯

隨后執(zhí)行 make

make 

等待編譯成功后將出現(xiàn)類似如下提示:

${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'

安裝

這時(shí) openssl1.1 就已經(jīng)編譯好了,我們還需要將動(dòng)態(tài)庫(kù)放入 /usr/local/lib中,執(zhí)行 make install 即可

sudo make install 

執(zhí)行成功后將出現(xiàn)類似以下提示:

/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

設(shè)置環(huán)境變量并生效

有些可執(zhí)行文件讀取的動(dòng)態(tài)鏈接庫(kù)的路徑不同,這里最好設(shè)置一下動(dòng)態(tài)鏈接庫(kù)的環(huán)境變量

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

執(zhí)行 source /etc/profile 使其在當(dāng)前客戶端生效

source /etc/profile

這樣就成功解決了這個(gè)問(wèn)題

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

欄目分類
最近更新