Is there any way to building static Qt with static OpenSSL?

Viewed 11100

Original question was slightly different but part of a more major question.

I am trying to build Qt 5.2 as static with static OpenSSL on Windows.

My final goal is to ship a single binary without the need to provide libeay32.dll and ssleay32.dll with it. However, it seems to me that this is impossible. I built static Qt with static openssl libs but it seems like Qt is outright ignoring the libs provided and always searches for DLLs.

This answer also suggests that QtNetwork always searches for DLLs and ignores everything else but it also states that "two options are to compile OpenSSL into Qt..." but this does not seem to be the case.

Can someone provide a definitive answer?

This is my Qt configure (line breaks added for readability):

configure -static -qmake -opensource -nomake examples -opengl desktop
-platform win32-msvc2010 -openssl -I C:\git\openssl\build\include
-L C:\git\openssl\build\lib OPENSSL_LIBS="-llibeay32 -lssleay32 -lgdi32"
4 Answers

build Qt statically with OpenSSL on Win 10

  1. download Qt 5.15.1 Source Code from Qt Maintenance Tool.
  2. install Python, Perl, OpenSSL, jom
  3. make sure they are in Path environment variable.
  4. open x64 Native Tools Command Prompt for VS 2019

download OpenSSL from here https://slproweb.com/products/Win32OpenSSL.html

# remove previous config cache
rm /d/Qt/5.15.1/Src/config.cache

set OPENSSL_DIR=C:\Program Files\OpenSSL-Win64
configure.bat -release -opensource -confirm-license -static -no-pch -optimize-size -opengl desktop -platform win32-msvc  -prefix "D:\Qt\5.15.1\msvc2019_64_static" -skip webengine -nomake tools -nomake tests -nomake examples -openssl-linked OPENSSL_INCDIR="%OPENSSL_DIR%\include" OPENSSL_LIBDIR="%OPENSSL_DIR%\lib\VC\static" OPENSSL_LIBS="-lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32 -llibssl64MDd -llibcrypto64MDd" OPENSSL_LIBS_DEBUG="-llibssl64MDd -llibcrypto64MDd" OPENSSL_LIBS_RELEASE="-llibssl64MD -llibcrypto64MD"  

D:\jom_1_1_3\jom.exe -j8
D:\jom_1_1_3\jom.exe -j8 install
Related