Compiling Qt 6.2.1: "qplatformdefs.h": No such file or directory

Viewed 442

So I have a problem, the Qt installer just fails when I try to install Qt 6.2.1, and I figured I will have to compile the source myself to get it to work. The configure.bat command line I have is:

configure -debug-and-release -opensource -confirm-license -platform win32-msvc2019 -nomake examples -nomake tests -prefix E:\qt-stuff\6.2.1-build\

(This and all the next commands are ran in x86 Native Tools Command Prompt for VS 2019)

It spams a lot of stuff in the console, and succeeds in the end, telling me this:

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 'E:/qt-stuff/6.2.1-build'

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

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

-- Configuring done
-- Generating done
-- Build files have been written to: E:/qt-stuff/qt-everywhere-src-6.2.1

But when I run cmake --build . --parallel 4, it spams a ton of paths to some files, and fails in the end, saying ninja: build stopped: subcommand failed.

The actual error I could find was this:

[78/15085] Building CXX object qtbase\src\tools\bootstrap\...ootstrap.dir\Release\__\__\corelib\text\qvsnprintf.cpp.obj
FAILED: qtbase/src/tools/bootstrap/CMakeFiles/Bootstrap.dir/Release/__/__/corelib/text/qvsnprintf.cpp.obj
C:\PROGRA~2\MICROS~2\2019\BUILDT~1\VC\Tools\MSVC\1429~1.301\bin\Hostx86\x86\cl.exe  /nologo /TP -DHAVE_CONFIG_H -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_FOREACH -DQT_USE_QSTRINGBUILDER -DQT_VERSION_MAJOR=6 -DQT_VERSION_MINOR=2 -DQT_VERSION_PATCH=1 -DQT_VERSION_STR=\"6.2.1\" -DUNICODE -DWIN32 -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -DCMAKE_INTDIR=\"Release\" -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\Core_autogen\include_Release -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include\QtCore -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\global -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\kernel -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\..\3rdparty\tinycbor\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include\QtCore\6.2.1 -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include\QtCore\6.2.1\QtCore -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\..\3rdparty\zlib\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\..\3rdparty\double-conversion\double-conversion -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\..\3rdparty\double-conversion -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\.rcc -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\mkspecs\win32-msvc2019 -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\3rdparty\pcre2\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\xml\Xml_autogen\include_Release -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include\QtXml -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\xml -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include\QtXml\6.2.1 -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include\QtXml\6.2.1\QtXml -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\tools\bootstrap\.. -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\tools\bootstrap\..\..\3rdparty\tinycbor\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\tools\bootstrap\..\..\3rdparty\pcre2\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\tools\bootstrap\..\..\3rdparty\zlib\src /DWIN32 /D_WINDOWS /DNDEBUG -O2 -MD /W3 -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 /showIncludes /Foqtbase\src\tools\bootstrap\CMakeFiles\Bootstrap.dir\Release\__\__\corelib\text\qvsnprintf.cpp.obj /Fdqtbase\src\tools\bootstrap\Release\Qt6Bootstrap.pdb /FS -c E:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\text\qvsnprintf.cpp
E:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\text\qvsnprintf.cpp(40): fatal error C1083: Не удается открыть файл включение: qplatformdefs.h: No such file or directory,

I have already compiled Qt in the past, and sometimes it worked, sometimes it didn't. But right now I cannot build it no matter what I try.

Any help would be appreciated

1 Answers

The issue is the platform parameter. Please replace win32-msvc2019 with win32-msvc.

The issue compiler cannot find the file because it is in qtbase\mkspecs\win32-msvc folder, but in your case it is looking in qtbase\mkspecs\win32-msvc2019.

I have checked help of the configure script, there is no information about possible values. As well as in the Qt documentation. It seems the only possible way to check the correct values is to list mkspecs folder

28.11.2021  13:29    <DIR>          aix-g++
28.11.2021  13:29    <DIR>          aix-g++-64
28.11.2021  13:29    <DIR>          android-clang
28.11.2021  13:29    <DIR>          cygwin-g++
28.11.2021  13:29    <DIR>          darwin-g++
28.11.2021  13:29    <DIR>          freebsd-clang
28.11.2021  13:29    <DIR>          freebsd-g++
28.11.2021  13:29    <DIR>          haiku-g++
28.11.2021  13:29    <DIR>          hpuxi-g++-64
28.11.2021  13:29    <DIR>          hurd-g++
28.11.2021  13:29    <DIR>          integrity-armv7
28.11.2021  13:29    <DIR>          integrity-armv7-imx6
28.11.2021  13:29    <DIR>          integrity-armv8-rcar
28.11.2021  13:29    <DIR>          integrity-x86
28.11.2021  13:29    <DIR>          linux-aarch64-gnu-g++
28.11.2021  13:29    <DIR>          linux-arm-gnueabi-g++
28.11.2021  13:29    <DIR>          linux-clang
28.11.2021  13:29    <DIR>          linux-clang-32
28.11.2021  13:29    <DIR>          linux-clang-libc++
28.11.2021  13:29    <DIR>          linux-clang-libc++-32
28.11.2021  13:29    <DIR>          linux-g++
28.11.2021  13:29    <DIR>          linux-g++-32
28.11.2021  13:29    <DIR>          linux-g++-64
28.11.2021  13:29    <DIR>          linux-icc
28.11.2021  13:29    <DIR>          linux-icc-32
28.11.2021  13:29    <DIR>          linux-icc-64
28.11.2021  13:29    <DIR>          linux-icc-k1om
28.11.2021  13:29    <DIR>          linux-llvm
28.11.2021  13:29    <DIR>          linux-lsb-g++
28.11.2021  13:29    <DIR>          lynxos-g++
28.11.2021  13:29    <DIR>          macx-clang
28.11.2021  13:29    <DIR>          macx-g++
28.11.2021  13:29    <DIR>          macx-icc
28.11.2021  13:29    <DIR>          macx-ios-clang
28.11.2021  13:29    <DIR>          macx-tvos-clang
28.11.2021  13:29    <DIR>          macx-watchos-clang
28.11.2021  13:29    <DIR>          macx-xcode
28.11.2021  13:29    <DIR>          netbsd-g++
28.11.2021  13:29    <DIR>          openbsd-g++
28.11.2021  13:29    <DIR>          qnx-aarch64le-qcc
28.11.2021  13:29    <DIR>          qnx-armle-v7-qcc
28.11.2021  13:29    <DIR>          qnx-x86-64-qcc
28.11.2021  13:29    <DIR>          qnx-x86-qcc
28.11.2021  13:29    <DIR>          solaris-cc
28.11.2021  13:29    <DIR>          solaris-cc-64
28.11.2021  13:29    <DIR>          solaris-cc-64-stlport
28.11.2021  13:29    <DIR>          solaris-cc-stlport
28.11.2021  13:29    <DIR>          solaris-g++
28.11.2021  13:29    <DIR>          solaris-g++-64
28.11.2021  13:29    <DIR>          wasm-emscripten
28.11.2021  13:29    <DIR>          win32-arm64-msvc
28.11.2021  13:29    <DIR>          win32-clang-g++
28.11.2021  13:29    <DIR>          win32-clang-msvc
29.11.2021  15:11    <DIR>          win32-g++
28.11.2021  13:29    <DIR>          win32-icc
28.11.2021  13:29    <DIR>          win32-icc-k1om
28.11.2021  13:29    <DIR>          win32-msvc
Related