18

I tried to run a simple program that is written with Qt and uses QSslSocket.

I'm running this program on a Ubuntu 12.04 machine with OpenSSL installed.

But I got the following errors:

QSslSocket: cannot call unresolved function SSLv3_client_method
QSslSocket: cannot call unresolved function SSL_CTX_new
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function ERR_get_error

How can I fix these errors?

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
s4eed
  • 7,173
  • 9
  • 67
  • 104

7 Answers7

35

On Windows/MinGW you need to copy these files to your exe directory.

C:\Qt\Tools\mingw492_32\opt\bin\libeay32.dll
C:\Qt\Tools\mingw492_32\opt\bin\ssleay32.dll

Or you can copy them to C:\Qt\Tools\mingw492_32\bin if you want it to work with all your apps. Obviously you need to distribute them with your program.

You actually don't need to add QT += network.

Timmmm
  • 88,195
  • 71
  • 364
  • 509
  • That's why I love SO. For your reference, the latest Qt/MinGW have these DLLs in the `\Qt\Tools\mingw530_32\opt\bin`. – Neurotransmitter Jan 20 '17 at 21:00
  • Interesting is dll files must be exactly in the exe directory, adding to working directory doesn't work. – Ali Dec 02 '18 at 09:05
13

Install the latest openSSL version. yum install openssl ,yum install libssl-dev..

And add QT += network in your .pro file

Source:http://codeblog.vurdalakov.net/2009/11/solution-qsslsocket-cannot-call.html

ScarCode
  • 3,074
  • 3
  • 19
  • 32
3

I had the same problem with QT 5.0.1 and QT 5.1.1, and finally I realized I need to copy OpenSSL DLL files next to the application binary file. For some reason QT do not load the DLL files from Windows Path ...

I've used OpenSSL Win32 0_9_8y

Roozbeh Zabihollahi
  • 7,207
  • 45
  • 39
3

For Ubuntu or (Debian based Linux) install openssl and libssl-dev

i.e. sudo apt-get install openssl libssl-dev.

For Red Hat , Fedora , CentOS (rpm based linux) install openssl and openssl-devel

i.e. yum install openssl openssl-devel

Ajinkya Bhosale
  • 343
  • 3
  • 9
2

I downgraded OpenSSL to version 1.0 and it worked.

anothernode
  • 5,100
  • 13
  • 43
  • 62
Hieu.Gi
  • 77
  • 6
1

You need to include this file:

 #include <QtNetwork>

And in your .pro file, add this line:

 QT += network
laurent
  • 88,262
  • 77
  • 290
  • 428
  • 1
    Thank u ! But If I hadn't done these steps, I couldn't even use QSslSocket itself. – s4eed Jun 01 '12 at 16:04
  • 2
    You can use `QSslSocket` without `+= network` - if you use `QWebView`. That said, the problem isn't caused by the lack of `+= network`; it is because of the missing OpenSSL DLLs. – Timmmm Jan 31 '16 at 18:17
0

Installing lua-openssl package on debian seems to have solved the issue for me.