Compiling QT5.15.0 with OpenSSL support with MSVC2017 on Windows

First, I compiled and installed OpenSSL 1.1.1g in the same way as before:

set PERL_ROOT=E:\PFiles\Strawberry\perl\bin
set PATH=%PERL_ROOT%;%PATH%
set PATH=%PATH%;C:\PFiles\nasm-2.14.02-win64
perl Configure VC-WIN64A
set CL=/MP
nmake
nmake install

Then I built QT5.15.0 as follows:

set MINGW_ROOT=E:\PFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
set PERL_ROOT=E:\PFiles\Strawberry\perl\bin
set RUBY_ROOT=C:\PFiles\Ruby27-x64\bin

set PATH=%PERL_ROOT%;%PATH%
set PATH=E:\PFiles\Python35;%PATH%
set PATH=%MINGW_ROOT%;%PATH%
set PATH=%PATH%;%RUBY_ROOT%
 
rem Check if the tools are in PATH
where gcc
where mingw32-make.exe
where perl.exe
where ruby.exe
where python.exe
 
rem QT_NO_EXCEPTIONS disables "try { } catch (...) {}" surrounding the user code in qthread_unix.cpp
configure.bat -prefix E:\Qt\Qt5.15.0\windows -DQT_NO_EXCEPTIONS -debug-and-release -force-debug-info -platform win32-msvc ^
  -I "C:\Program Files\OpenSSL\include" -L "C:\Program Files\OpenSSL\lib" ^
  -opensource -confirm-license -nomake tests -nomake examples ^
  -skip networkauth -skip serialport -skip serialbus -skip activeqt -skip quick3d -skip quicktimeline -skip lottie -skip remoteobjects -skip scxml ^
  -skip webglplugin -skip webchannel -skip gamepad -skip 3d -skip wayland -skip connectivity -skip sensors -skip script ^
  -skip location -skip xmlpatterns -skip speech -skip virtualkeyboard -skip datavis3d -skip charts -skip webengine -skip webview -skip doc ^
  -skip macextras -skip x11extras -skip androidextras
 
set CL=/MP
nmake

nmake install

When building Qt from source, the configuration system checks for the presence of the openssl/opensslv.h, see the official docs. Config output should include:

OpenSSL ................................ yes
  Qt directly linked to OpenSSL ........ no
OpenSSL 1.1 ............................ yes

But I was unable to link OpenSSL at compile time (directly):

configure.bat -prefix E:\Qt\Qt5.15.0\windows -DQT_NO_EXCEPTIONS -release -force-debug-info -platform win32-msvc ^
  -openssl-linked OPENSSL_LIBS="-llibcrypto -llibssl" -I "C:\Program Files\OpenSSL\include" -L "C:\Program Files\OpenSSL\lib" ^
  -opensource -confirm-license -nomake tests -nomake examples

The error was:

ERROR: Feature 'openssl-linked' was enabled, but the pre-condition '!features.securetransport && !features.schannel && libs.openssl' failed.

Leave a Reply

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