10

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?

guillaumegoui
  • 451
  • 1
  • 4
  • 14

5 Answers5

10

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.

guillaumegoui
  • 451
  • 1
  • 4
  • 14
  • Musescore had me in a login loop until i launched it from the terminal, this error showed up and i found your answer. Thanks dude!! – RegularGuy Aug 16 '19 at 23:26
  • Thank you, I downgraded OpenSSL via apt from 1.1 to 1.0 and my issues vanished. – Aminos Dec 31 '19 at 17:13
4

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.

vvas
  • 49
  • 1
3

using the maintenance tool you can add openSSL-1.1.1

you can find it at<QT-INSTALLATION-DIR>/tools/openSSL/src

then build it

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

and based on @vvas answer copy libcrypto.so.1.1 libssl.so.1.1 to <QTDIR>/6.3.1/gcc_64/lib

this has worked for me ... with Qt 6.3.1 on fedora 36

0x4d6f652e51
  • 43
  • 2
  • 8
1

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
Community
  • 1
  • 1
  • had the same issue with f5vpn and those commands saved me and solved the problem of openssl / libssl but still facing QT version issue, requesting 5.5 and i have 5.12, i don't know why they are considering 5.12 < 5.5 loool, @Guilherme did you get this error too? – Oussama Boumaad Feb 01 '21 at 13:03
1

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 openssl@1.1 like this:

$ brew install openssl@1.1

Then I just added these lines to my project file:

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

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.

Hamid Rouhani
  • 2,309
  • 2
  • 31
  • 45