Using QSslSocket with custom OpenSSL
-
@MChelik
on windows they are called ssleay32.dll and libeay32.dll -
@raven-worx Since QSslSocket::sslLibraryBuildVersionString() returns "OpenSSL 1.0.2g 1 Mar 2016", I downloaded OpenSSL_1.0.2g source code and compiled it, but inside bin directory there was only openssl.exe. So I copied ssleay32.dll and libeay32.dll from C:\Qt\Tools\QtCreator\bin to C:\Windows. But still I get same error, nothing changed.
What should I do use QSslSocket? I'm really confused. I searched a lot but nothing helped. -
Hi and welcome to devnet,
Don't copy .dlls like that in the Windows folder, that's very bad practice.
If Qt shows you a different version of OpenSSL, it likely means that you have an application that also provides these files and can be found before yours.
I've successfully used the prebuilt packages from Shining Lights Production.
Hope it helps
-
@MChelik said in Using QSslSocket with custom OpenSSL:
So I copied ssleay32.dll and libeay32.dll from C:\Qt\Tools\QtCreator\bin to C:\Windows
don't do that, as @SGaist said. Copy them next to your application exe instead.
-
Thank you SGaist. Copying next to application executable didn't help either.
Gentlemen, let's forget my OpenSSL; forget everything. Just assume that I want to use QSslSocket and QSslCertificate. What should I do? Should I compile Qt myself? Should I install OpenSSL? What should I do exactly? Qt documents doesn't say any specific thing about this. Documents say only how to use mentioned two classes.
Thank you -
Hi, just a quick note on OpenSSL with Qt, I think because you're building a 64-bit Qt app that's why you're having problems. Because those 2 DLLs s stored in C:\Qt\Tools\QtCreator\bin are built with MSVC2013 32-bit compiler (same as for Qt Creator itself) so they are not kosher for 64-bit :-(
-
To add to @hskoglund, the prebuilt packages I've mentioned earlier also provide "OpenSSL-Win64" which are pre-built for 64bit development.
-
@hskoglund That was my problem! I didn't pay attention to that. But I a have a question: The only libeay32.dll and ssleay32.dll files that are in my %PATH% is C:\Win64-OpenSSL\bin directory. So why my application only works when mentioned DLLs are beside my application (doesn't work when are in %PATH)?
-
Are you sure you don't have any other application that has these libraries and that can be found in your PATH environment variable ?
-
How did you modify PATH ? In your Windows settings or in Qt Creator ?
-
Hi, also, they could be loaded via some other means than their directories being listed in %PATH%, either that some other dll that your .exe loads explicitly pulls in the bad (i.e. 32-bit) ones, or perhaps they're hiding in c:\windows or c:\windows\system32.
To debug this. you could try download Dependency Walker and load your app into it. Then start profiling with F7, that'll get you a trace of all the dlls loaded.
-
This post is deleted!
-
This post is deleted!
-
Using Qt5.7+msvc2015+W8
Solved, in Qt_naming dll respect, without openssl compilation :
http://www.npcglib.org/~stathis/downloads/openssl-1.0.1t-vs2015.7z -
Not in Qt but within Qt Creator. Go to the Run part of the Project panel. There you can modify your environment for your application only.
-
@raven-worx Not any more. As of OpenSSL 1.1.0, following OpenSSL's build instructions on Windows (and with shared libraries enabled), we get:
bin/libcrypto-1_1.dll
bin/libssl-1_1.dll
lib/libcrypto.lib
lib/libssl.libThe names "ssleay32" and "libeay32" were deprecated. So does Qt only look for the old names despite any attempts at configuring it otherwise?
Qt's docs on the topic, for some reason, only describe building OpenSSL for Android.