linux下编译openssl
2021/8/20 7:07:10
本文主要是介绍linux下编译openssl,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
一、问题
在Qt中使用https,运行时报错:
qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method
1
二、原因分析
SSLv2由于某些漏洞导致的不安全原因, 在某些linux发行版里的openssl库禁用掉了SSLv2
三、解决办法
重新编译openssl
1、下载openssl
git clone https://github.com/openssl/openssl.git
1
2、编译
./config enable-shared
make -j4
1
2
3、部署
将ssl和crypto库拷贝到Qt目录lib下:
cp libssl.so* libcrypto.so* ~/Qt5.6.3/5.6.3/gcc_64/lib/ -a
1
4、新的错误
重新运行时,报错
qt.network.ssl: QSslSocket: cannot call unresolved function *
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_num_locks
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_id_callback
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_locking_callback
qt.network.ssl: QSslSocket: cannot resolve ERR_free_strings
qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_cleanup
qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_init
qt.network.ssl: QSslSocket: cannot resolve sk_new_null
qt.network.ssl: QSslSocket: cannot resolve sk_push
qt.network.ssl: QSslSocket: cannot resolve sk_free
qt.network.ssl: QSslSocket: cannot resolve sk_num
qt.network.ssl: QSslSocket: cannot resolve sk_pop_free
qt.network.ssl: QSslSocket: cannot resolve sk_value
qt.network.ssl: QSslSocket: cannot resolve SSL_library_init
qt.network.ssl: QSslSocket: cannot resolve SSL_load_error_strings
qt.network.ssl: QSslSocket: cannot resolve SSL_get_ex_new_index
qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv3_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv2_server_method
qt.network.ssl: QSslSocket: cannot resolve SSLv3_server_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_server_method
qt.network.ssl: QSslSocket: cannot resolve X509_STORE_CTX_get_chain
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
qt.network.ssl: QSslSocket: cannot resolve SSLeay
qt.network.ssl: QSslSocket: cannot resolve SSLeay_version
qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_num_locks
qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
qt.network.ssl: QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
qt.network.ssl: QSslSocket: cannot call unresolved function sk_num
qt.network.ssl: QSslSocket: cannot call unresolved function SSLeay
qt.network.ssl: QSslSocket: cannot call unresolved function SSLeay
qt.network.ssl: QSslSocket: cannot call unresolved function SSLeay
qt.network.ssl: QSslSocket: cannot call unresolved function SSLeay
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
四、解决新错误
参考博客:https://www.cnblogs.com/btian/p/6130560.html
Qt5.6对openssl版本的要求1.0,而从git上下载的最新版本是1.1的;
其它Qt的版本对openssl的要求未测试。
1、查看版本信息
git branch -r
origin/HEAD -> origin/master
origin/OpenSSL-engine-0_9_6-stable
origin/OpenSSL-fips-0_9_7-stable
origin/OpenSSL-fips-0_9_8-stable
origin/OpenSSL-fips-1_2-stable
origin/OpenSSL-fips-2_0-dev
origin/OpenSSL-fips-2_0-stable
origin/OpenSSL-fips2-0_9_7-stable
origin/OpenSSL_0_9_6-stable
origin/OpenSSL_0_9_7-stable
origin/OpenSSL_0_9_8-stable
origin/OpenSSL_0_9_8fg-stable
origin/OpenSSL_1_0_0-stable
origin/OpenSSL_1_0_1-stable
origin/OpenSSL_1_0_2-stable
origin/OpenSSL_1_1_0-stable
origin/OpenSSL_1_1_1-stable
origin/SSLeay
origin/master
origin/tls1.3-draft-18
origin/tls1.3-draft-19
2、导出1.0.2版本
git checkout -b openssl-1.0.2 origin/OpenSSL_1_0_2-stable
3、编译
./config enable-shared
make -j4
4、部署
cp libssl.so* libcrypto.so* ~/Qt5.6.3/5.6.3/gcc_64/lib/ -a
重新运行不再报错
————————————————
版权声明:本文为CSDN博主「郭老二」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u010168781/article/details/85632637
这篇关于linux下编译openssl的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-12如何创建可引导的 ESXi USB 安装介质 (macOS, Linux, Windows)
- 2024-11-08linux的 vi编辑器中搜索关键字有哪些常用的命令和技巧?-icode9专业技术文章分享
- 2024-11-08在 Linux 的 vi 或 vim 编辑器中什么命令可以直接跳到文件的结尾?-icode9专业技术文章分享
- 2024-10-22原生鸿蒙操作系统HarmonyOS NEXT(HarmonyOS 5)正式发布
- 2024-10-18操作系统入门教程:新手必看的基本操作指南
- 2024-10-18初学者必看:操作系统入门全攻略
- 2024-10-17操作系统入门教程:轻松掌握操作系统基础知识
- 2024-09-11Linux部署Scrapy学习:入门级指南
- 2024-09-11Linux部署Scrapy:入门级指南
- 2024-08-21【Linux】分区向左扩容的方法