QNetworkAccessManager 在 arch 上给出 ssl 错误

Posted

技术标签:

【中文标题】QNetworkAccessManager 在 arch 上给出 ssl 错误【英文标题】:QNetworkAccessManager gives ssl errors on arch 【发布时间】:2017-06-01 11:43:42 【问题描述】:

我想使用 QNetworkAccessManager 通过 https 访问页面,但是当我尝试它时,我得到以下输出:

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 SSLeay  
qt.network.ssl: QSslSocket: cannot call unresolved function  SSLeay_version

我使用的是 arch x86_64 和 QT 5.9。

在终端输入后:openssl version -v 我得到了OpenSSL 1.1.0f 25 May 2017,所以它是最新的。

我也添加到 main.cpp:

qDebug() << "SSL version use for build "
         << QSslSocket::sslLibraryBuildVersionString();
qDebug() <<"SSL version use for run-time "
         << QSslSocket::sslLibraryVersionNumber();

我得到了以下信息:

SSL version use for build:  "OpenSSL 1.0.1e-fips 11 Feb 2013"
SSL version use for run-time:  0

您有什么建议可以解决这个问题吗?

【问题讨论】:

【参考方案1】:

检查您主机上安装的OpenSSL 的版本

QNetworkAccessManager 尝试在运行时加载的库中查找函数。

很可能您安装了旧版本的OpenSSL

还要检查 thread 上的 QtOpenSSL 编译时/运行时依赖项

【讨论】:

以上是关于QNetworkAccessManager 在 arch 上给出 ssl 错误的主要内容,如果未能解决你的问题,请参考以下文章

如何恢复 QNetworkAccessManager

Qt:在QNetworkAccessManager中发送请求后连接信号[重复]

错误:没有用于调用“QNetworkAccessManager::QNetworkAccessManager(Networking* const)”的匹配函数

如何在 QNetworkAccessManager 中保存/加载 cookie

QNetworkAccessManager 读取传出数据并将其保存在 QIODevice

QNetworkAccessManager 在 arch 上给出 ssl 错误