Building QT 6.1.0 for Android on Windows

Theoretically it can be:

git clone --recursive https://code.qt.io/qt/qt5.git --branch v6.1.0

or alternatively:

git clone https://code.qt.io/qt/qt5.git --branch v6.1.0
./init-repository --branch --module-subset=essential,qtandroidextras,qtsvg,qtquickcontrols2,qtgraphicaleffects,qtwebsockets,qtmultimedia

or

./init-repository --module-subset=all

and the following script:

rem This script is based on the steps decribed here: https://doc-snapshots.qt.io/qt6-dev/android-building.html
rem https://forum.qt.io/topic/125137/building-qt-6-for-android-on-windows-from-sources
rem Strawberry Perl and MinGW are already in PATH after install.
rem unzip /c/Users/D-Ef/Downloads/qt-everywhere-src-6.0.2.zip

set "CMAKE_ROOT=E:\PFiles\cmake-3.19.1-win64-x64\bin"
set "NINJA_ROOT=E:\PFiles\ninja-win"
set "JDK_ROOT=C:\Program Files\Android\Android Studio\jre\bin"
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 PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%JDK_ROOT%;%PATH%
set PATH=%MINGW_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=E:\PFiles\Python35;%PATH%
  
rem Check if the tools are in PATH
where gcc
where mingw32-make.exe
where perl.exe
where javac.exe
where python.exe
where cmake.exe
where ninja.exe
  
set "ANDROID_SDK_ROOT=C:\Users\D-Ef\AppData\Local\Android\Sdk"
set "ANDROID_NDK_PATH=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle"
rem See qtbase\mkspecs\android-clang\qmake.conf
set "ANDROID_NDK_PLATFORM=android-21"
rem see %ANDROID_SDK_ROOT%\build-tools folder
set "ANDROID_BUILD_TOOLS_REVISION=29.0.2"

set "MY_INSTALL_PATH=E:\Qt\Qt6.0.2\android"
set QT_HOST_PATH=%MY_INSTALL_PATH%
  
rem QT_NO_EXCEPTIONS disables "try { } catch (...) {}" surrounding the user code in qthread_unix.cpp
configure.bat -prefix %MY_INSTALL_PATH% -qt-host-path %MY_INSTALL_PATH% -DQT_NO_EXCEPTIONS=1 -release -force-debug-info -platform win32-g++ -opengl es2 -xplatform android-clang ^
  -android-ndk %ANDROID_NDK_PATH% -android-sdk %ANDROID_SDK_ROOT% -android-abis arm64-v8a -android-ndk-host windows-x86_64 ^
  -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 
  
cmake --build . --parallel

cmake --install .

Probably -qt-host-path should point to an already existing native build of your host platform, otherwise we’ll get:

'E:/PFiles/cmake-3.19.1-win64-x64/bin/cmake.exe' '-DQT_HOST_PATH=E://Qt//Qt6.0.2//android' '-DCMAKE_INSTALL_PREFIX=E://Qt//Qt6.0.2//android' '-DQT_QMAKE_TARGET_MKSPEC=win32-g++' '-DQT_QMAKE_TARGET_MKSPEC=android-clang' '-DANDROID_SDK_ROOT=C://Users//D-Ef//AppData//Local//Android//Sdk' '-DANDROID_NDK_ROOT=C://Users//D-Ef//AppData//Local//Android//Sdk//ndk-bundle' '-DANDROID_ABI=arm64-v8a' '-DQT_BUILD_TESTS=FALSE' '-DQT_BUILD_EXAMPLES=FALSE' '-DCMAKE_BUILD_TYPE=RelWithDebInfo' '-DQT_EXTRA_DEFINES=QT_NO_EXCEPTIONS=1' '-DINPUT_opengl=es2' '-G' 'Ninja' 'E:/repos/qt-everywhere-src-6.0.2'
-- Android NDK detected: C://Users//D-Ef//AppData//Local//Android//Sdk/ndk-bundle
-- Android toolchain file detected
Check dependencies of 'qtbase'
Check dependencies of 'qt5compat'
Check dependencies of 'qtsvg'
Check dependencies of 'qtdeclarative'
Check dependencies of 'qttools'
Check dependencies of 'qtquickcontrols2'
Check dependencies of 'qtdoc'
Check dependencies of 'qtshadertools'
Check dependencies of 'qtquick3d'
Check dependencies of 'qtquicktimeline'
Check dependencies of 'qttranslations'
Check dependencies of 'qtwayland'
Configuring 'qtbase'
-- Android NDK detected: C://Users//D-Ef//AppData//Local//Android//Sdk/ndk-bundle
-- Android toolchain file detected
CMake Error at qtbase/cmake/QtSetup.cmake:173 (message):
  You need to set QT_HOST_PATH to cross compile Qt.
Call Stack (most recent call first):
  qtbase/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake:173 (include)
  qtbase/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake:271 (qt_build_internals_set_up_private_api)
  qtbase/CMakeLists.txt:57 (qt_build_repo_begin)

-- Configuring incomplete, errors occurred!

See also "E:/repos/qt-everywhere-src-6.0.2/CMakeFiles/CMakeOutput.log".
See also "E:/repos/qt-everywhere-src-6.0.2/CMakeFiles/CMakeError.log".
CMake Error at qtbase/cmake/QtProcessConfigureArgs.cmake:786 (message):
  CMake exited with code 1.

So probably we need to build QT for Windows first, so I tried:

git submodule foreach --recursive "git clean -dfx"
git submodule foreach --recursive "git checkout ."
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64

set "CMAKE_ROOT=E:\PFiles\cmake-3.19.1-win64-x64\bin"
set "NINJA_ROOT=E:\PFiles\ninja-win"
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 PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%MINGW_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=E:\PFiles\Python35;%PATH%
  
rem Check if the tools are in PATH
where gcc
where mingw32-make.exe
where perl.exe
where python.exe
where cmake.exe
where ninja.exe

set "MY_INSTALL_PATH=E:\Qt\Qt6.0.2\windows"
set CL=/MP

configure.bat -prefix %MY_INSTALL_PATH% -DQT_NO_EXCEPTIONS=1 -release -force-debug-info -platform win32-msvc -opengl es2 ^
  -opensource -confirm-license -nomake tests -nomake examples ^
  -skip qtgraphicaleffects

and got the following summary:

Building for: win32-msvc (x86_64, CPU features: cx16 mmx sse sse2 sse3)
Compiler: gcc 8.1.0
Build options:
  Mode ................................... release (with debug info)
  Optimize release build for size ........ no
  Fully optimize release builds (-O3) .... no
  Building shared libraries .............. yes
  Using C standard ....................... C11
  Using C++ standard ..................... C++17
  Generating GDB index ................... no
  Relocatable ............................ yes
  Using precompiled headers .............. yes
  Using LTCG ............................. no
  Target compiler supports:
    SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
    AVX .................................. <none>
    AVX512 ............................... <none>
    Other x86 ............................ AES RDRAND SHA
    Intrinsics without -mXXX option ...... yes
  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 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
Qt Core:
  DoubleConversion ....................... yes
    Using system DoubleConversion ........ no
  GLib ................................... no
  ICU .................................... no
  Using system libb2 ..................... no
  Built-in copy of the MIME database ..... yes
  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 ............................... no
  OpenSSL ................................ yes
    Qt directly linked to OpenSSL ........ no
  OpenSSL 1.1 ............................ yes
  DTLS ................................... yes
  OCSP-stapling .......................... yes
  SCTP ................................... no
  Use system proxies ..................... yes
  GSSAPI ................................. no
  Brotli Decompression Support ........... no
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 .......................-- Configuring done
. no
  Vulkan ................................. no
  Session Management ..................... yes
Features used by QPA backends:
  evdev .................................. no
  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
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
  QNX:
    lgmon ................................ no
    IMF .................................. no
  XCB:
    Using system-provided xcb-xinput ..... no
    Native painting (experimental) ....... 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 ........................ no
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 .............................. no
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... yes
  PostgreSQL ............................. no
  SQLite ................................. yes
    Using system provided SQLite ......... no

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

Once everything is built, you must run 'cmake --install .'
Qt will be installed into 'E:/Qt/Qt6.0.2/windows'

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

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

-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_qtgraphicaleffects


-- Build files have been written to: E:/repos/qt5/qtbase

Then I did

cmake --build . --parallel

and got a compiler error:

E:\repos\qt5\qtbase>cmake --build . --parallel
[47/1791] Building CXX object src/tools/bootstrap/CMakeFiles/Bootstrap.dir/__/__/corelib/global/qmalloc.cpp.obj
FAILED: src/tools/bootstrap/CMakeFiles/Bootstrap.dir/__/__/corelib/global/qmalloc.cpp.obj
E:\PFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\c++.exe -DHAVE_CONFIG_H -DMINGW_HAS_SECURE_API=1 -DPCRE2_CODE_UNIT_WIDTH=16 -DPCRE2_DISABLE_JIT -DPCRE2_STATIC -DQT_BOOTSTRAPPED -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS=1 -DQT_NO_FOREACH -DQT_USE_QSTRINGBUILDER -DQT_VERSION_MAJOR=6 -DQT_VERSION_MINOR=1 -DQT_VERSION_PATCH=0 -DQT_VERSION_STR=\"6.1.0\" -DUNICODE -DWIN32 -DWIN64 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN32_WINNT=0x0601 -D_WIN64 -Isrc/corelib/Core_autogen/include -Iinclude -Iinclude/QtCore -Isrc/corelib -Isrc/corelib/global -Isrc/corelib/kernel -Isrc/corelib/../3rdparty/tinycbor/src -Iinclude/QtCore/6.1.0 -Iinclude/QtCore/6.1.0/QtCore -Isrc/corelib/../3rdparty/zlib/src -Isrc/corelib/../3rdparty -Isrc/corelib/../3rdparty/double-conversion/include -Isrc/corelib/.rcc -Imkspecs/win32-msvc -Isrc/3rdparty/pcre2/src -Isrc/xml/Xml_autogen/include -Iinclude/QtXml -Isrc/xml -Iinclude/QtXml/6.1.0 -Iinclude/QtXml/6.1.0/QtXml -Isrc/tools/bootstrap/.. -Isrc/tools/bootstrap/../../3rdparty/tinycbor/src -Isrc/tools/bootstrap/../../3rdparty/pcre2/src -Isrc/tools/bootstrap/../../3rdparty/zlib/src -g -DNDEBUG -O2 -fvisibility=hidden -fno-keep-inline-dllexport -Wall -Wextra -ffunction-sections -fdata-sections -std=gnu++17 -MD -MT src/tools/bootstrap/CMakeFiles/Bootstrap.dir/__/__/corelib/global/qmalloc.cpp.obj -MF src\tools\bootstrap\CMakeFiles\Bootstrap.dir\__\__\corelib\global\qmalloc.cpp.obj.d -o src/tools/bootstrap/CMakeFiles/Bootstrap.dir/__/__/corelib/global/qmalloc.cpp.obj -c src/corelib/global/qmalloc.cpp
In file included from src/corelib/global/qmalloc.cpp:40:
mkspecs/win32-msvc/qplatformdefs.h:138:13: error: conflicting declaration 'typedef int mode_t'
 typedef int mode_t;
             ^~~~~~
In file included from E:/PFiles/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/pthread.h:64,
                 from E:/PFiles/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32/bits/gthr-default.h:35,
                 from E:/PFiles/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32/bits/gthr.h:148,
                 from E:/PFiles/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ext/atomicity.h:35,
                 from E:/PFiles/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/basic_string.h:39,
                 from E:/PFiles/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/string:52,
                 from E:/PFiles/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/stdexcept:39,
                 from E:/PFiles/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/array:39,
                 from E:/PFiles/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/tuple:39,
                 from E:/repos/qt5/qtbase/src/corelib/tools/qcontainerfwd.h:46,
                 from include/QtCore/qcontainerfwd.h:1,
                 from E:/repos/qt5/qtbase/src/corelib/global/qtypeinfo.h:42,
                 from include/QtCore/qtypeinfo.h:1,
                 from E:/repos/qt5/qtbase/src/corelib/global/qglobal.h:1336,
                 from include/QtCore/qglobal.h:1,
                 from mkspecs/win32-msvc/qplatformdefs.h:51,
                 from src/corelib/global/qmalloc.cpp:40:
E:/PFiles/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/sys/types.h:77:17: note: previous declaration as 'typedef _mode_t mode_t'
 typedef _mode_t mode_t;
                 ^~~~~~
[56/1791] Building CXX object src/3rdparty/harfbuzz-ng/CMakeFiles/BundledHarfbuzz.dir/src/hb-subset.cc.obj
ninja: build stopped: subcommand failed.

My mistake was that I included MinGW into the PATH. The correct script is:

CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64

set "CMAKE_ROOT=E:\PFiles\cmake-3.19.1-win64-x64\bin"
set "NINJA_ROOT=E:\PFiles\ninja-win"
set "PERL_ROOT=E:\PFiles\Strawberry\perl\bin"
 
set PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=E:\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=E:\Qt\Qt6.0.2\windows"
set CL=/MP

configure.bat -prefix %MY_INSTALL_PATH% -DQT_NO_EXCEPTIONS=1 -release -force-debug-info -platform win32-msvc -opengl es2 ^
  -opensource -confirm-license -nomake tests -nomake examples ^
  -skip qtgraphicaleffects

cmake --build . --parallel

Configure summary (now the compiler is win32-msvc):

Building for: win32-msvc (x86_64, CPU features: sse sse2)
Compiler: msvc 19.28.29910.0
Build options:
  Mode ................................... release (with debug info)
  Optimize release build for size ........ no
  Fully optimize release builds (-O3) .... no
  Building shared libraries .............. yes
  Using C standard ....................... C11
  Using C++ standard ..................... C++17
  Relocatable ............................ yes
  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 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
Qt Core:
  DoubleConversion ....................... yes
    Using system DoubleConversion ........ no
  GLib ................................... no
  ICU .................................... no
  Using system libb2 ..................... no
  Built-in copy of the MIME database ..... yes
  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 ............................... no
  OpenSSL ................................ yes
    Qt directly linked to OpenSSL ........ no
  OpenSSL 1.1 ............................ yes
  DTLS ................................... yes
  OCSP-stapling .......................... yes
  SCTP ................................... no
  Use system proxies ..................... yes
  GSSAPI ................................. no
  Brotli Decompression Support ........... no
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
  INTEGRITY HID .......................... no
  mtdev .................................. no
  tslib .................................. no
  xkbcommon .............................. no
  X11 specific:
    XLib ................................. no
    XCB Xlib ............................. no
    EGL on X11 ........................... no
    xkbcommon-x11 ........................ 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 ......................-- Configuring done
..... no
    EGLFS Raspberry Pi ................... no
    EGLFS X11 ............................ no
  LinuxFB ................................ no
  VNC .................................... no
  QNX:
    lgmon ................................ no
    IMF .................................. no
  XCB:
    Using system-provided xcb-xinput ..... no
    Native painting (experimental) ....... 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 .............................. no
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... yes
  PostgreSQL ............................. no
  SQLite ................................. yes
    Using system provided SQLite ......... no

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

Once everything is built, you must run 'cmake --install .'

It was a step to a right direction, but I got an error again:

[1052/1801] Building CXX object src\testlib\CMakeFiles\Test.dir\qtestresult.cpp.obj
FAILED: src/testlib/CMakeFiles/Test.dir/qtestresult.cpp.obj
C:\PROGRA~2\MICROS~3\2019\COMMUN~1\VC\Tools\MSVC\1428~1.299\bin\Hostx64\x64\cl.exe  /nologo /TP -DQT_ASCII_CAST_WARNINGS -DQT_BUILDING_QT -DQT_BUILD_TESTLIB_LIB -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_MOC_COMPAT -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DATASTREAM -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS=1 -DQT_NO_FOREACH -DQT_USE_QSTRINGBUILDER -DTest_EXPORTS -DUNICODE -DWIN32 -DWIN64 -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_USE_MATH_DEFINES -D_WIN64 -D_WINDLL -Isrc\testlib\Test_autogen\include -Iinclude -Iinclude\QtTest -Isrc\testlib -Iinclude\QtTest\6.1.0 -Iinclude\QtTest\6.1.0\QtTest -Iinclude\QtCore -Imkspecs\win32-msvc -Isrc\corelib -Iinclude\QtCore\6.1.0 -Iinclude\QtCore\6.1.0\QtCore /DWIN32 /D_WINDOWS /GR /Zi   /DNDEBUG -O2 -MD /W3 /EHsc -Zc:__cplusplus -permissive- -utf-8 -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:externConstexpr -Zc:wchar_t -guard:cf -std:c++17 /YuE:/repos/qt5/qtbase/src/testlib/CMakeFiles/Test.dir/cmake_pch.hxx /FpE:/repos/qt5/qtbase/src/testlib/CMakeFiles/Test.dir/./cmake_pch.cxx.pch /FIE:/repos/qt5/qtbase/src/testlib/CMakeFiles/Test.dir/cmake_pch.hxx /showIncludes /Fosrc\testlib\CMakeFiles\Test.dir\qtestresult.cpp.obj /Fdsrc\testlib\CMakeFiles\Test.dir\ /FS -c src\testlib\qtestresult.cpp
src\testlib\qtestresult.cpp(77): error C3861: 'qTerminate': identifier not found
[1055/1801] Linking CXX shared library bin\Qt6DBus.dll
   Creating library lib\Qt6DBus.lib and object lib\Qt6DBus.exp
[1061/1801] Building CXX object src\gui\CMakeFiles\Gui.dir\cmake_pch.cxx.obj
ninja: build stopped: subcommand failed.

It is because I added -DQT_NO_EXCEPTIONS=1, without it QT builds and installs the following libraries:

Qt6Concurrent.dll
Qt6Core.dll
Qt6DBus.dll
Qt6Gui.dll
Qt6Network.dll
Qt6OpenGL.dll
Qt6OpenGLWidgets.dll
Qt6PrintSupport.dll
Qt6Sql.dll
Qt6Test.dll
Qt6Widgets.dll
Qt6Xml.dll

It is because I run a wrong configure.bat file from qtbase directory, but not from the root directory. My 4-th attempt was:

configure.bat -prefix %MY_INSTALL_PATH% -release -force-debug-info -platform win32-msvc -opengl es2 ^
  -opensource -confirm-license -nomake tests -nomake examples ^
  -skip qtgraphicaleffects -skip qtwebsockets

finally I built it, but without qtmultimedia and qtpurchasing.

Links:

Leave a Reply

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