Building QT 6.3.1 with OpenSSL for Windows

After various experimentation I was able to build QT 6.3.1 with OpenSSL for Windows with the following steps:

Extract archives with Bash:

tar -xzf ../distrib/openssl-1.1.1q.tar.gz
tar -xf ../distrib/qt-everywhere-src-6.3.1.tar.xz

Building OpenSSL 1.1.1q

Run the following commands with x64 Native Tools Command Prompt for VS 2022:

set PATH=%PATH%;C:\dev\PFiles\Strawberry\perl\bin
set PATH=%PATH%;C:\dev\PFiles\nasm-2.15.05
perl Configure VC-WIN64A

if you got something like this

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL file first)         ***
***                                                                ***
**********************************************************************

build it:

set CL=/MP
nmake

and install as administrator:

set PATH=%PATH%;C:\dev\PFiles\Strawberry\perl\bin
set PATH=%PATH%;C:\dev\PFiles\nasm-2.15.05
set CL=/MP
nmake install

Building QT 6.3.1

Run the following commands with Windows Command Prompt:

"C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64
  
set "CMAKE_ROOT=C:\dev\PFiles\cmake-3.24.0-rc4-windows-x86_64\bin"
set "NINJA_ROOT=C:\dev\PFiles\ninja-win"
set "PERL_ROOT=C:\dev\PFiles\Strawberry\perl\bin"
  
set PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=C:\dev\PFiles\Python35;%PATH%
  
rem Check if the tools are in PATH
where perl.exe
where python.exe
where cmake.exe
where ninja.exe
  
set "MY_INSTALL_PATH=C:/dev/libs/Qt6.3.1/windows"
set CL=/MP

configure.bat -prefix %MY_INSTALL_PATH% -DQT_NO_EXCEPTIONS=1 -debug-and-release -force-debug-info -platform win32-msvc -opensource -confirm-license ^
-c++std c++20 -static -I "C:/Program Files/OpenSSL/include" -L "C:/Program Files/OpenSSL/lib" -openssl-linked ^
  -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtcoap -skip qtconnectivity ^
  -skip qtdatavis3d -skip qtdoc -skip qtlottie -skip qtmqtt -skip qtnetworkauth -skip qtopcua ^
  -skip qtserialport -skip qtpositioning -skip qtquicktimeline -skip qtquick3d -skip qtremoteobjects ^
  -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtvirtualkeyboard -skip qtwayland ^
  -skip qtwebchannel -skip qtwebengine -skip qtwebview -skip qttools -skip qttranslations

Check the configure summary:

Building for: win32-msvc (x86_64, CPU features: sse sse2)
Compiler: msvc 19.32.31332.0
Build options:
  Mode ................................... debug and release (with debug info)
  Optimize release build for size ........ no
  Fully optimize release builds (-O3) .... no
  Building shared libraries .............. no
  Using C standard ....................... C11
  Using C++ standard ..................... C++20
  Relocatable ............................ no
  Using precompiled headers .............. yes
  Using LTCG ............................. no
  Target compiler supports:
    SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
    AVX .................................. AVX AVX2
    AVX512 ............................... F ER CD PF DQ BW VL IFMA VBMI
    Other x86 ............................ AES F16C RDRAND SHA
  Sanitizers:
    Addresses ............................ no
    Threads .............................. no
    Memory ............................... no
    Fuzzer (instrumentation only) ........ no
    Undefined ............................ no
  Build parts ............................ libs tools
  App store compliance ................... no
Qt modules and options:
  Qt Concurrent .......................... yes
  Qt D-Bus ............................... yes
  Qt D-Bus directly linked to libdbus .... no
  Qt Gui ................................. yes
  Qt Network ............................. yes
  Qt PrintSupport ........................ yes
  Qt Sql ................................. yes
  Qt Testlib ............................. yes
  Qt Widgets ............................. yes
  Qt Xml ................................. yes
Support enabled for:
  Using pkg-config ....................... no
  udev ................................... no
  Using system zlib ...................... no
  Zstandard support ...................... no
  Thread support ......................... yes
Common build options:
  Linker can resolve circular dependencies  yes
Qt Core:
  backtrace .............................. no
  DoubleConversion ....................... yes
    Using system DoubleConversion ........ no
  GLib ................................... no
  ICU .................................... no
  Using system libb2 ..................... no
  Built-in copy of the MIME database ..... yes
  cpp/winrt base ......................... no
  Tracing backend ........................ <none>
  Logging backends:
    journald ............................. no
    syslog ............................... no
    slog2 ................................ no
  PCRE2 .................................. yes
    Using system PCRE2 ................... no
Qt Sql:
  SQL item models ........................ yes
Qt Network:
  getifaddrs() ........................... no
  IPv6 ifname ............................ no
  libproxy ............................... no
  Schannel ............................... yes
  OpenSSL ................................ yes
    Qt directly linked to OpenSSL ........ yes
  OpenSSL 1.1 ............................ yes
  DTLS ................................... yes
  OCSP-stapling .......................... yes
  SCTP ................................... no
  Use system proxies ..................... yes
  GSSAPI ................................. no
  Brotli Decompression Support ........... no
Core tools:
  Android deployment tool ................ yes
  macOS deployment tool .................. no
  Windows deployment tool ................ yes
  qmake .................................. yes
Qt Gui:
  Accessibility .......................... yes
  FreeType ............................... yes
    Using system FreeType ................ no
  HarfBuzz ............................... yes
    Using system HarfBuzz ................ no
  Fontconfig ............................. no
  Image formats:
    GIF .................................. yes
    ICO .................................. yes
    JPEG ................................. yes
      Using system libjpeg ............... no
    PNG .................................. yes
      Using system libpng ................ no
  Text formats:
    HtmlParser ........................... yes
    CssParser ............................ yes
    OdfWriter ............................ yes
    MarkdownReader ....................... yes
      Using system libmd4c ............... no
    MarkdownWriter ....................... yes
  EGL .................................... no
  OpenVG ................................. no
  OpenGL:
    Desktop OpenGL ....................... no
    Dynamic OpenGL ....................... yes
    OpenGL ES 2.0 ........................ no
    OpenGL ES 3.0 ........................ no
    OpenGL ES 3.1 ........................ no
    OpenGL ES 3.2 ........................ no
  Vulkan ................................. no
  Session Management ..................... yes
Features used by QPA backends:
  evdev .................................. no
  libinput ............................... no
  HiRes wheel support in libinput ........ no
  INTEGRITY HID .......................... no
  mtdev .................................. no
  tslib .................................. no
  xkbcommon .............................. no
  X11 specific:
    XLib ................................. no
    XCB Xlib ............................. no
    EGL on X11 ........................... no
    xkbcommon-x11 ........................ no
    xcb-sm ............................... no
QPA backends:
  DirectFB ............................... no
  EGLFS .................................. no
  EGLFS details:
    EGLFS OpenWFD ........................ no
    EGLFS i.Mx6 .......................... no
    EGLFS i.Mx6 Wayland .................. no
    EGLFS RCAR ........................... no
    EGLFS EGLDevice ...................... no
    EGLFS GBM ............................ no
    EGLFS VSP2 ........................... no
    EGLFS Mali ........................... no
    EGLFS Raspberry Pi ................... no
    EGLFS X11 ............................ no
  LinuxFB ................................ no
  VNC .................................... no
  VK_KHR_display ......................... no
  QNX:
    lgmon ................................ no
    IMF .................................. no
  XCB:
    Using system-provided xcb-xinput ..... no
    GL integrations:
      GLX Plugin ......................... no
        XCB GLX .......................... no
      EGL-X11 Plugin ..................... no
  Windows:
    Direct 2D ............................ yes
    Direct 2D 1.1 ........................ yes
    DirectWrite .......................... yes
    DirectWrite 3 ........................ yes
Qt Widgets:
  GTK+ ................................... no
  Styles ................................. Fusion Windows WindowsVista
Qt Testlib:
  Tester for item models ................. yes
Qt PrintSupport:
  CUPS ................................... no
Qt Sql Drivers:
  DB2 (IBM) .............................. no
  InterBase .............................. n
o
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... yes
  PostgreSQL ............................. no
  SQLite ................................. yes
    Using system provided SQLite ......... no
Further Image Formats:
  JasPer ................................. no
  MNG .................................... no
  TIFF ................................... yes
    Using system libtiff ................. no
  WEBP ................................... yes
    Using system libwebp ................. no
Qt QML:
  QML network support .................... yes
  QML debugging and profiling support .... yes
  QML just-in-time compiler .............. yes
  QML sequence object .................... yes
  QML XML http request ................... yes
  QML Locale ............................. yes
Qt QML Models:
  QML list model ......................... yes
  QML delegate model ..................... yes
Qt Quick:
  AnimatedImage item .............Note: Using static linking will disable the use of dynamically loaded plugins. Make sure to import all needed static plugins, or compile needed modules into the library.
Note: When linking against OpenSSL, you can override the default library names through OPENSSL_LIBS. For example: OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked
........ yes
  Canvas item ............................ yes
  Support for Qt Quick Designer .......... yes
  Flipable item .......................... yes
  GridView item .......................... yes
  ListView item .......................... yes
  TableView item ......................... yes
  TreeView item .......................... yes
  Path support ........................... yes
  PathView item .......................... yes
  Positioner items ....................... yes
  Repeater item .......................... yes
  ShaderEffect item ...................... yes
  Sprite item ............................ yes
Qt Quick Templates 2:
  Hover support .......................... yes
  Multi-touch support .................... yes
  Calendar support ....................... yes
Qt Quick Controls 2:
  Styles ................................. Basic Fusion Imagine Material Universal macOS Windows
Qt Multimedia:
  GStreamer 1.0 .......................... no
  Video for Linux ........................ no
  Linux DMA
WARNING: Basic cpp/winrt support missing. Some features might not be available.

buffer support ............... no
  MMRenderer ............................. no
  AVFoundation ........................... no
  Windows Media Foundation ............... yes

--

Qt is now configured for building. Just run 'cmake --build . --parallel'

Once everything is built, you must run 'ninja install'
Qt will be installed into 'C:/dev/libs/Qt6.3.1/windows'

To configure and build other Qt modules, you can use the following convenience script:
        C:/dev/libs/Qt6.3.1/windows/bin/qt-configure-module.bat

If reconfiguration fails for some reason, try removing 'CMakeCache.txt' from the build directory

-- Configuring done
-- Generating done
-- Build files have been written to: C:/dev/repos/qt-everywhere-src-6.3.1

Build it and install:

cmake --build . --parallel
ninja install

Both OpenSSL and QT depend on Runtime DLLs:

Probably I’l try -static-runtime QT option next time.

Notes

  • QT did not build with OpenSSL installed to non-default directory.
  • I exclueded qttools and qttranslations modules that did not built this time, so LinguistTools module can’t be used, for example.

Setting up QT Creator 8.0

2 Responses to Building QT 6.3.1 with OpenSSL for Windows

  1. felaja says:

    Could you please show us how to compile Qt with ICU support?

    1. dmitriano says:

      From docs: At compile time, the include and lib folders of the ICU installation must be appended to the INCLUDE and LIB environment variables. Did you try this?

Leave a Reply

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