编译 Qt 6.2.1: "qplatformdefs.h": 没有那个文件或目录
Compiling Qt 6.2.1: "qplatformdefs.h": No such file or directory
所以我有一个问题,当我尝试安装 Qt 6.2.1 时 Qt 安装程序失败了,我想我必须自己编译源代码才能让它工作。我的 configure.bat
命令行是:
configure -debug-and-release -opensource -confirm-license -platform win32-msvc2019 -nomake examples -nomake tests -prefix E:\qt-stuff.2.1-build\
(此命令和所有下一个命令在 VS 2019 的 x86 本机工具命令提示符中是 运行)
它在控制台中发送了很多垃圾邮件,最后成功了,告诉我:
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
但是当我 运行 cmake --build . --parallel 4
时,它会向一些文件发送大量路径,最后失败,说 ninja: build stopped: subcommand failed.
我能找到的实际错误是:
[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~219\BUILDT~1\VC\Tools\MSVC29~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\..rdparty\tinycbor\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include\QtCore.2.1 -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include\QtCore.2.1\QtCore -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\..rdparty\zlib\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\..rdparty\double-conversion\double-conversion -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\..rdparty\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\srcrdparty\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.2.1 -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include\QtXml.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\..\..rdparty\tinycbor\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\tools\bootstrap\..\..rdparty\pcre2\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\tools\bootstrap\..\..rdparty\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,
我以前编译过Qt,有时能用,有时不能用。但是现在无论我尝试什么都无法构建它。
如有任何帮助,我们将不胜感激
问题出在 platform
参数上。请将 win32-msvc2019
替换为 win32-msvc
.
问题编译器找不到该文件,因为它位于 qtbase\mkspecs\win32-msvc
文件夹中,但在您的情况下,它正在查找 qtbase\mkspecs\win32-msvc2019
.
我查看了配置脚本的帮助,没有关于可能值的信息。以及在 Qt 文档中。似乎检查正确值的唯一可能方法是列出 mkspecs 文件夹
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
所以我有一个问题,当我尝试安装 Qt 6.2.1 时 Qt 安装程序失败了,我想我必须自己编译源代码才能让它工作。我的 configure.bat
命令行是:
configure -debug-and-release -opensource -confirm-license -platform win32-msvc2019 -nomake examples -nomake tests -prefix E:\qt-stuff.2.1-build\
(此命令和所有下一个命令在 VS 2019 的 x86 本机工具命令提示符中是 运行)
它在控制台中发送了很多垃圾邮件,最后成功了,告诉我:
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
但是当我 运行 cmake --build . --parallel 4
时,它会向一些文件发送大量路径,最后失败,说 ninja: build stopped: subcommand failed.
我能找到的实际错误是:
[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~219\BUILDT~1\VC\Tools\MSVC29~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\..rdparty\tinycbor\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include\QtCore.2.1 -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include\QtCore.2.1\QtCore -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\..rdparty\zlib\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\..rdparty\double-conversion\double-conversion -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\corelib\..rdparty\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\srcrdparty\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.2.1 -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\include\QtXml.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\..\..rdparty\tinycbor\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\tools\bootstrap\..\..rdparty\pcre2\src -IE:\qt-stuff\qt-everywhere-src-6.2.1\qtbase\src\tools\bootstrap\..\..rdparty\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,
我以前编译过Qt,有时能用,有时不能用。但是现在无论我尝试什么都无法构建它。
如有任何帮助,我们将不胜感激
问题出在 platform
参数上。请将 win32-msvc2019
替换为 win32-msvc
.
问题编译器找不到该文件,因为它位于 qtbase\mkspecs\win32-msvc
文件夹中,但在您的情况下,它正在查找 qtbase\mkspecs\win32-msvc2019
.
我查看了配置脚本的帮助,没有关于可能值的信息。以及在 Qt 文档中。似乎检查正确值的唯一可能方法是列出 mkspecs 文件夹
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