Qt 6.8.1 Dynamic Compilation Guide for Windows 7

Last Modified: 15-01-2025

This guide focuses on a full Qt 6.8.1 dynamic compilation with MSVC on Windows 7 with all optional modules. We require to use Qt 6.5.0 WebEngine as it is the last version with Chromium pre-110 support required for Windows 7.

Time to compile: around 5 hours on Intel Core i7-4770 @ 3.40GHz (4C/8T).

Required Software

Qt6

  • MSVC build tools 2019 or higher.
  • CMake 3.21 or higher.
  • Ninja 1.7.2 or higher.
  • Python >3.7 and <3.10. 3.8 is highly recommended.

    If you have other Python installations higher than 3.9, move them to a seperate directory temporarily and hide it.

  • Git.
  • LLVM 17 or higher with RTTI support. Recommended Version for MSVC 2019.
  • OpenSSL 3.0.15 or higher. Required to link statically to OpenSSL libs; no longer require libcrypto-3-x64.dll and libssl-3-x64.dll for QtWebChannel.

Qt6 WebEngine

  • Windows 11 SDK 10.0.22621.0 or higher.
  • Node.js 12 or higher.
  • Python html5lib.

    python -m pip install html5lib

  • Bison, Flex, and GPerf. You can compile them from source or use just about any precompiled executable you find online.

Required Files

Steps

  1. Create directory structure. For the purposes of this guide, we choose a Qt home directory of C:\Qt.
  2. Extract sources

    • Qt 6.8.1 sources to C:\Qt\6.8.1\src.
    • Qt 6.5.0 WebEngine source to C:\Qt\6.5.0\src\qtwebengine.
  3. Apply patches

    • For Qt 6.8.1, simply override all files in C:\Qt\6.8.1\src with the ones included in the Windows 7 GitHub repoistory.
    • Delete the qtwebengine directory in C:\Qt\6.8.1\src. We will be configuring and building Qt 6.5.0 one later.
    • For Qt 6.5.0, place the patch in C:\Qt\6.5.0\src\qtwebengine and execute the following command in Git Bash in the same directory:
      patch -p1 -l < Qt6.5-WebEngine-Qt6.8.1.patch
      
  4. Configure Qt 6.8.1 building prerequisites

    • Extract LLVM recommended version to C:\Qt\Tools\LLVM.
    • Set up hunspell for QtVirtualKeyboard as follows:
      • Clone the hunspell repistory in C:\Qt\6.8.1\src\qtvirtualkeyboard\src\plugins\hunspell\3rdparty\hunspell
        git clone https://github.com/hunspell/hunspell
        
      • Extract keyboard language files in C:\Qt\6.8.1\src\qtvirtualkeyboard\src\plugins\hunspell\3rdparty\hunspell and verify they are located under data directory.
  5. Build Qt 6.8.1 sources

    • Create build directory C:\Qt\6.8.1\build.
    • Select installation directory C:\Qt\6.8.1\msvc2019_64.
    • Verify OpenSSL directory C:\Program Files\OpenSSL.
    • Open x64 Native Tools Command Prompt for VS 2019 and execute the following commands line-by-line:
      1
      2
      3
      cd C:\Qt\6.8.1\build
      set LLVM_INSTALL_DIR=C:\Qt\Tools\LLVM
      C:\Qt\6.8.1\src\configure.bat -prefix C:\Qt\6.8.1\msvc2019_64 -opensource -opengl desktop -confirm-license -platform win32-msvc -release -openssl-linked -- -Wno-dev "-DOPENSSL_ROOT_DIR=C:\Program Files\OpenSSL" "-DOPENSSL_INCLUDE_DIR=C:\Program Files\OpenSSL\include" -DOPENSSL_USE_STATIC_LIBS=ON
      
    • Wait for configuration to complete. No errors or warnings should be reported.
    • Build all of Qt 6.8.1 with the following command. This should take around an hour or two.
      cmake --build . --parallel
      
    • Once building is complete, install Qt 6.8.1 to the chosen installation directory using the following command.
      cmake --install .
      
    • To verify successful building, open designer.exe in C:\Qt\6.8.1\msvc2019_64\bin. The Qt Widgets Designer should open fine.
  6. Build Qt 6.5.0 WebEngine sources

    • Create build directory C:\Qt\6.5.0\build\qtwebengine.
    • Verify installation directory C:\Qt\6.8.1\msvc2019_64.
    • Open x64 Native Tools Command Prompt for VS 2019 and execute the following commands line-by-line:
      1
      2
      3
      cd C:\Qt\6.5.0\build\qtwebengine
      set LLVM_INSTALL_DIR=C:\Qt\Tools\LLVM
      C:\Qt\6.8.1\msvc2019_64\bin\qt-configure-module C:\Qt\6.5.0\src\qtwebengine
      
    • Wait for configuration to complete. No errors or warnings should be reported.
    • Build Qt 6.5.0 with the following command. This should take around three to four hours.
      cmake --build . --parallel
      
    • Once building is complete, install Qt 6.5.0 WebEngine to the chosen installation directory using the following command.
      cmake --install .
      
    • To verify successful building, find Qt6WebEngineCore.dll in the installation directory C:\Qt\6.8.1\msvc2019_64\bin.
Edit

Pub: 15 Jan 2025 21:43 UTC

Edit: 15 Jan 2025 22:16 UTC

Views: 194