6.2.1, msvc static, missing /permissive- compiler option
-
Hello,
I'm trying to build Qt 6.2.1 static on Win10 using MS VC 19.26.28806 (VS 2019 16.6.2). Here is my configuration:mkdir build cd build ..\configure.bat -debug-and-release -opensource -developer-build -static -static-runtime ^ -c++std c++17 ^ -nomake tests -nomake examples -nomake tools ^ -opengl dynamic -direct2d -qt-libpng -qt-libjpeg ^ -skip qtwebchannel ^ -skip qtwebengine ^ -skip qtwebview ^ -skip qtwebplugin ^ -skip qtwebsockets ^ -skip qtwebview ^ -skip qttools ^ -skip qtdoc ^ -skip qttranslations ^ -- -D QT_BUILD_TESTS_BY_DEFAULT=OFF -D QT_NO_BUILD_TESTS=ON -D QT_BUILD_STANDALONE_TESTS=OFF
configuration went relatively good, then I start to build:
cmake --build . --parallel
and immediately get the following errors in several places:
D:\dev\qt6\build\qtbase\include\QtCore\../../../../qtbase/src/corelib/global/qglobal.h(105): error C2338: On MSVC you must pass the /permissive- option to the compiler.
I do not really see, where should I pass that option and why it was not set automatically?
Thanks.
-
This flag is set in qt_set_msvc_cplusplus_options() inside QtFlagHandlingHelpers.cmake - maybe add a debug message in there to make sure it's really added or not. Are you sure you set up your environment - maybe there is an older cl.exe in your path...
-
Are you sure you set up your environment - maybe there is an older cl.exe in your path...
I've checked several times, that's the current output:
-- CMAKE_VERSION: "3.22.0-rc1" -- CMAKE_HOST_SYSTEM: "Windows-10.0.19043" -- CMAKE_HOST_SYSTEM_NAME: "Windows" -- CMAKE_HOST_SYSTEM_VERSION: "10.0.19043" -- CMAKE_HOST_SYSTEM_PROCESSOR: "AMD64" -- CMAKE_SYSTEM: "Windows" -- CMAKE_SYSTEM_NAME: "Windows" -- CMAKE_SYSTEM_VERSION: "10.0.19043" -- CMAKE_SYSTEM_PROCESSOR: "AMD64" -- CMAKE_CROSSCOMPILING: "FALSE" -- CMAKE_C_COMPILER: "D:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe" (19.26.28806.0) -- CMAKE_CXX_COMPILER: "D:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe" (19.26.28806.0) -- MSVC_VERSION: "1926" -- MSVC_TOOLSET_VERSION: "142"
I've set the following just to check
if(MSVC AND MSVC_VERSION GREATER_EQUAL 1913) message(FATAL_ERROR "We are here") target_compile_options("${target}" ${visibility} "-Zc:__cplusplus" "-permissive-") endif()
it happens, so the function is called. After I've made a clean configuration (removed everything in the build folder), configuraton went good but then again:
D:\dev\qt6\build\qtbase\include\QtCore\../../../../qtbase/src/corelib/global/qglobal.h(105): error C2338: On MSVC you must pass the /permissive- option to the compiler.
and what's interesting, the option is there
"D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\Hostx64\x64\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_TYPESAFE_FLAGS -DQT_USE_QSTRINGBUILDER -DQT_VERSION_MAJOR=6 -DQT_VERSION_MINOR=3 -DQT_VERSION_PATCH=0 -DQT_VERSION_STR=\"6.3.0\" -DUNICODE -DWIN32 -DWIN64 -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -DCMAKE_INTDIR=\"Release\" -ID:\dev\qt6\build\qtbase\src\corelib\Core_autogen\include_Release -ID:\dev\qt6\build\qtbase\include -ID:\dev\qt6\build\qtbase\include\QtCore -ID:\dev\qt6\qtbase\src\corelib -ID:\dev\qt6\build\qtbase\src\corelib -ID:\dev\qt6\build\qtbase\src\corelib\global -ID:\dev\qt6\build\qtbase\src\corelib\kernel -ID:\dev\qt6\qtbase\src\corelib\..\3rdparty\tinycbor\src -ID:\dev\qt6\build\qtbase\include\QtCore\6.3.0 -ID:\dev\qt6\build\qtbase\include\QtCore\6.3.0\QtCore -ID:\dev\qt6\qtbase\src\corelib\..\3rdparty\zlib\src -ID:\dev\qt6\qtbase\src\corelib\..\3rdparty\double-conversion\double-conversion -ID:\dev\qt6\qtbase\src\corelib\..\3rdparty\double-conversion -ID:\dev\qt6\build\qtbase\src\corelib\.rcc -ID:\dev\qt6\build\qtbase\mkspecs\win32-msvc -ID:\\dev\\OpenSSL\\include -ID:\dev\qt6\qtbase\src\3rdparty\pcre2\src -ID:\dev\qt6\build\qtbase\src\xml\Xml_autogen\include_Release -ID:\dev\qt6\build\qtbase\include\QtXml -ID:\dev\qt6\qtbase\src\xml -ID:\dev\qt6\build\qtbase\src\xml -ID:\dev\qt6\build\qtbase\include\QtXml\6.3.0 -ID:\dev\qt6\build\qtbase\include\QtXml\6.3.0\QtXml -ID:\dev\qt6\qtbase\src\tools\bootstrap\.. -ID:\dev\qt6\qtbase\src\tools\bootstrap\..\..\3rdparty\tinycbor\src -ID:\dev\qt6\qtbase\src\tools\bootstrap\..\..\3rdparty\pcre2\src -ID:\dev\qt6\qtbase\src\tools\bootstrap\..\..\3rdparty\zlib\src /DWIN32 /D_WINDOWS /DNDEBUG -O2 -MT /W3 **-permissive-** -Zc:__cplusplus -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\global\qglobal.cpp.obj /Fdqtbase\src\tools\bootstrap\Release\Qt6Bootstrap.pdb /FS -c D:\dev\qt6\qtbase\src\corelib\global\qglobal.cpp
but still the error is there
-
So, I've kind of solved that, I've updated to the latest VS, installed last available WinSDK (there were build errors with old ones), just comment out the check in the qglobal.h
//static_assert(!std::is_convertible_v<std::nullptr_t, bool>, // "On MSVC you must pass the /permissive- option to the compiler.");
After all I needed to disable building of qttools, there were other errors. That's not the perfect solution but at least I built it. And still I want to know why it does not build as explained in the documentation and having now LTS release 6.2.