-
while building QT 6.1.0 for Windows I got the following 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 build steps are:
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 cmake --build . --parallel
what did I do wrong?
my compiler is VS2019.
see the full story here https://developernote.com/2021/05/building-qt-6-1-0-for-android-on-windows/#windows
-
@Dmitriano said in Compiler errors while building QT 6.1.0 for Windows:
E:\PFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\c++.exe
As you can see the gcc compiler is picked up. Make sure it's not in your PATH and the MSVC development environment is properly set up (vsvars.bat etc.) so configure.bat is using MSVC instead gcc.
Why do you want to compile Qt by yourself? -
@Christian-Ehrlicher I compile QT by myself because I prefer QT with -DQT_NO_EXCEPTIONS=1, it disables try/catch block surrounding QThread's loop.
I removed MinGW from the PATH and looks like it started to build.