Compiling OpenSSL 1.1 with MSVC2017 for using with QT 5.13

QT does not work with OpenSSL 1.0 anymore. Versions QT 5.12.4 and above require OpenSSL 1.1, but fortunately OpenSSL 1.1 can be easily compiled with MS2017 as follows:

set PATH=%PATH%;C:\Perl64\bin
set PATH=%PATH%;C:\PFiles\nasm-2.14.02-win64
perl Configure VC-WIN64A
nmake

The key to the success is using ‘VS2017 x64 Native Tools Command Prompt‘, but not ‘VS2017 Developer Command Prompt’.

To make QT use OpenSSL, two dlls

libcrypto-1_1-x64.dll
libssl-1_1-x64.dll

should be copied to QT binary directory, for example, C:\Qt\Qt5.13.0\5.13.0\msvc2017_64\bin

5 Responses to Compiling OpenSSL 1.1 with MSVC2017 for using with QT 5.13

  1. superadmin on June 5, 2020 at 8:27 PM:

    A simple check that you can run afterwards to see if this worked is call the static function QSslSocket::supportsSsl(), if this function returns true, Qt has found the openSSL binaries that you downloaded. (Of course ensure that you add Qt += network in your .pro file before running this test), see https://stackoverflow.com/questions/3516143/qt-ssl-support-missing

  2. superadmin on June 5, 2020 at 8:36 PM:

    Linking OpenSSL statically https://stackoverflow.com/questions/24261974/how-to-build-qt5-with-openssl-support
    -openssl-linked OPENSSL_LIBS=”-lssleay32 -llibeay32″

  3. superadmin on June 5, 2020 at 8:38 PM:

    By default, an SSL-enabled Qt library dynamically loads any installed OpenSSL library at run-time. However, it is possible to link against the library at compile-time by configuring Qt with the -openssl-linked option, see https://doc.qt.io/qt-5/ssl.html

  4. superadmin on June 5, 2020 at 8:42 PM:
  5. superadmin on June 5, 2020 at 9:02 PM:

    When building Qt from source, the configuration system checks for the presence of the openssl/opensslv.h header provided by source or developer packages of OpenSSL.
    see https://doc.qt.io/qt-5/ssl.html

Leave a Reply

Your email address will not be published. Required fields are marked *