Ubuntu上的Qt和OpenSSL不兼容版本

wmomyfyw  于 2022-12-03  发布在  其他
关注(0)|答案(5)|浏览(712)

我在Ubuntu 18.04上尝试让QNetwork类与Qt5.11.1一起工作时遇到问题
我的系统上安装了openssl 1.1.0g和libssl-dev。
Qt使用的openssl版本是1.0.2k,我用QSslSocket::sslLibraryBuildVersionString()检查过,加上QSslSocket::supportsSsl()返回false
我试图让我的头周围这一点,但我总是有这些错误:

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 SSLv3_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_client_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: Incompatible version of OpenSSL

我已经检查了多个问题和论坛关于这一点,似乎没有什么工作对我来说。有人有任何想法吗?

kx1ctssn

kx1ctssn1#

我终于成功了。
我已经从源代码中安装了openssl 1. 0. 2k。我已经下载了我需要的here版本,并按照this page上的教程操作。
在这样做之后,我仍然有一些错误,但不是不兼容版本的错误。为了修复这个问题,我已经安装了libssl1.0-dev,一切都很好(感谢这个家伙)。
我希望这能对某些人有所帮助。

xhv8bpkk

xhv8bpkk2#

我已经将libcrypto.solibssl.so(v1.0.2)复制到了我当前的编译器lib目录(<QTDIR>/5.11.1/gcc_64/lib)中。libssl.so.1.0.0libcrypto.so.1.0.0,复制并重命名。它对我很有效。

zour9fqk

zour9fqk3#

使用维护工具,您可以添加openSSL-1.1.1
您可以在<QT-INSTALLATION-DIR>/tools/openSSL/src找到它
然后构建它

$ ./config --prefix=$HOME/openssl-1.1.1/ssl --openssldir=$HOME/openssl-1.1.1/ssl shared zlib
$ make
$ make install

并且基于@vvasanswerlibcrypto.so.1.1复制到<QTDIR>/6.3.1/gcc_64/lib
这对我很有效...在Fedora 36上使用Qt 6. 3. 1

mwkjh3gx

mwkjh3gx4#

我在Ubuntu 16.04上使用Qt 5.13.1时遇到了这个问题。
在我的Qt环境中,QSslSocket::sslLibraryBuildVersionString()QSslSocket::supportsSsl()的值分别为"OpenSSL 1.1.1b 26 Feb 2019"false
每次QNetworkAccessManager访问https地址时都会生成以下输出:

qt.network.ssl: QSslSocket: cannot resolve OPENSSL_init_ssl
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_init_crypto
qt.network.ssl: QSslSocket: cannot resolve ASN1_STRING_get0_data
qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_reset
qt.network.ssl: QSslSocket: cannot resolve RSA_bits
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_sk_new_null
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_sk_push
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_sk_free
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_sk_num
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_sk_pop_free
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_sk_value
qt.network.ssl: QSslSocket: cannot resolve DH_get0_pqg
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_options
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_ciphersuites
qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_use_session_callback
qt.network.ssl: QSslSocket: cannot resolve SSL_get_client_random
qt.network.ssl: QSslSocket: cannot resolve SSL_SESSION_get_master_key
qt.network.ssl: QSslSocket: cannot resolve SSL_session_reused
qt.network.ssl: QSslSocket: cannot resolve SSL_set_options
qt.network.ssl: QSslSocket: cannot resolve TLS_method
qt.network.ssl: QSslSocket: cannot resolve TLS_client_method
qt.network.ssl: QSslSocket: cannot resolve TLS_server_method
qt.network.ssl: QSslSocket: cannot resolve X509_up_ref
qt.network.ssl: QSslSocket: cannot resolve X509_STORE_CTX_get0_chain
qt.network.ssl: QSslSocket: cannot resolve X509_getm_notBefore
qt.network.ssl: QSslSocket: cannot resolve X509_getm_notAfter
qt.network.ssl: QSslSocket: cannot resolve X509_get_version
qt.network.ssl: QSslSocket: cannot resolve X509_STORE_set_ex_data
qt.network.ssl: QSslSocket: cannot resolve X509_STORE_get_ex_data
qt.network.ssl: QSslSocket: cannot resolve OpenSSL_version_num
qt.network.ssl: QSslSocket: cannot resolve OpenSSL_version
qt.network.ssl: Incompatible version of OpenSSL
qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed

我在Ubuntu上安装了Homebrew软件包管理器,然后安装了openssl@1.1,如下所示:

$ brew install openssl@1.1

然后,我将这些行添加到项目文件中:

LIBS += -L/home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1c/lib -lssl -lcrypto
INCLUDEPATH += /home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1c/include

QSslSocket::sslLibraryBuildVersionString()的值仍然是旧的值"OpenSSL 1.1.1b 26 Feb 2019",但QSslSocket::supportsSsl()的值变成了true,这解决了我的问题。

b4qexyjb

b4qexyjb5#

我通过创建一个指向openssl 1.1.0的symobolic链接解决了这个问题,方法如下:
创建覆盖/opt/f5/vpn/lib中的libcrypto.so.1.0.0和libssl.so.1.0.0的符号链接:

sudo ln -sf /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 /opt/f5/vpn/lib/libcrypto.so.1.0.0 

    sudo ln -sf /usr/lib/x86_64-linux-gnu/libssl.so.1.1 /opt/f5/vpn/lib/libssl.so.1.0.0

相关问题