环境:Red Hat 8.10,Qt 5.6.3
报错如下:
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
1.检查openssl版本
查看系统openssl版本,命令行运行:openssl version -a
查看Qt支持的版本,新建一个测试程序:
修改.pro:QT += core gui network
#include "mainwindow.h"
#include <QDebug>
#include <QSslSocket>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
qDebug() << QSslSocket::sslLibraryBuildVersionString();
}
运行后输出如下:
"OpenSSL 1.0.1e-fips 11 Feb 2013"
可以看到和系统中的不一致
2.下载
https://www.openssl.org/source/openssl-1.0.1e.tar.gz
也可直接在github查找并下载:https://github.com/openssl/openssl/releases
3.编译
tar zxvf openssl-1.0.1e.tar.gz
cd openssl-1.0.1e
./config shared
make
4.复制库到对应目录
cp -a libcrypto.so* libssl.so* /opt/Qt5.6.3/5.6.3/gcc_64/lib
https://blog.csdn.net/weixin_73899513/article/details/135847891
评论区