c++qtsslopenssl

QSslSocket: SSL support not available despite OpenSSL DLLs present (Qt 5.2.1, Windows, MinGW)


I'm developing a Qt application on Windows using Qt 5.2.1 with MinGW 4.8.0. I need to perform HTTPS requests, but my application fails to detect SSL support.

Here’s what I’ve done:

  1. I placed libeay32.dll and ssleay32.dll (from OpenSSL 1.0.2u) next to the built .exe file.
  2. I included OpenSSL headers and libraries in my project.
  3. I verified that QSslSocket::supportsSsl() returns false, and both sslLibraryBuildVersionString() and sslLibraryVersionString() return empty strings. The debug console shows:
Supports SSL: false
SSL library version (runtime): ""
SSL support available: false

I also encountered runtime errors indicating missing Qt DLLs (Qt5Core.dll, Qt5Gui.dll, Qt5Widgets.dll).

enter image description here

Project structure:

My question:

What else should I configure or fix to make QSslSocket recognize OpenSSL and enable HTTPS support?

Is it possible that Qt 5.2.1 was built without OpenSSL support? If so, how can I verify or work around that (e.g., rebuilding Qt or switching to libcurl)?


Solution

  • Is it possible that Qt 5.2.1 was built without OpenSSL support?

    Yes, absolutely, according to sslLibraryBuildVersionString, empty string means that your Qt was built without SSL support. Also, considering that this function was introduced in QT 5.4 I find it surprising that your code compiles.

    What else should I configure or fix to make QSslSocket recognize OpenSSL and enable HTTPS support?

    I would recommend simply updating QT to version that was built with SSL support, unfortunately it seems that you are restricted by your environment. Then, you can re-build your Qt5.2 from source, with SSL support, possibly using static linking for convenience (in case you suspect that your runtime openssl library might differ).