Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt and OpenSSL incompatible version on Ubuntu

Tags:

openssl

ubuntu

qt

I am having issues trying to make QNetwork classes work with Qt5.11.1 on Ubuntu 18.04

I have openssl 1.1.0g and libssl-dev installed on my system.

The openssl version used by Qt is 1.0.2k. I have checked with QSslSocket::sslLibraryBuildVersionString(). Plus QSslSocket::supportsSsl() returns false.

I am trying to get my head around this but I am always having these errors:

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

I have checked multiple questions and forums about that and nothing seems to work for me. Anybody got any idea?

like image 515
guillaumegoui Avatar asked Sep 06 '18 19:09

guillaumegoui


4 Answers

I have finally managed to make it work.

I have installed openssl 1.0.2k from the sources. I have downloaded the version I needed here and followed the tutorial on this page.

After doing so I was still having some of the errors but not the ones for the incompatible version. To fix that I have installed libssl1.0-dev and everything was good to go (thx to this guy).

I hope this will help somebody.

like image 112
guillaumegoui Avatar answered Oct 17 '22 00:10

guillaumegoui


I've copied libcrypto.so and libssl.so (v1.0.2) to my current compiler lib directory (<QTDIR>/5.11.1/gcc_64/lib). In my case I took theese 2 libs in /usr/lib/x86_64-linux-gnu/: libssl.so.1.0.0 and libcrypto.so.1.0.0, copied and renamed. It worked for me.

like image 44
vvas Avatar answered Oct 17 '22 00:10

vvas


I had this problem with Qt 5.13.1 on Ubuntu 16.04.

Values of QSslSocket::sslLibraryBuildVersionString() and QSslSocket::supportsSsl() in my Qt environment are "OpenSSL 1.1.1b 26 Feb 2019" and false.

This output was generated every time QNetworkAccessManager accessed an https address:

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

Non of above solutions worked for me. I installed Homebrew package manager on my Ubuntu and then installed [email protected] like this:

$ brew install [email protected]

Then I just added these lines to my project file:

LIBS += -L/home/linuxbrew/.linuxbrew/Cellar/[email protected]/1.1.1c/lib -lssl -lcrypto
INCLUDEPATH += /home/linuxbrew/.linuxbrew/Cellar/[email protected]/1.1.1c/include

The value of QSslSocket::sslLibraryBuildVersionString() remained the old value "OpenSSL 1.1.1b 26 Feb 2019" but the value of QSslSocket::supportsSsl() became true and it solved my problem.

like image 23
Hamid Rouhani Avatar answered Oct 17 '22 02:10

Hamid Rouhani


I resolved this problem creating a symobolic link to openssl 1.1.0, this way:

Create symbolic links that overwrite libcrypto.so.1.0.0 and libssl.so.1.0.0 in /opt/f5/vpn/lib:

    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
like image 1
Guilherme Eduardo Bittencourt Avatar answered Oct 17 '22 00:10

Guilherme Eduardo Bittencourt