Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-108323

qt-cmake.bat configures invalid compiler

XMLWordPrintable

    • 3aa6f0b39 (dev), 58187aa14 (6.6)

      QTDIR\bin features qt-cmake.bat, which is a convenient alternative to configure your project. Anyhow, for some setups, this won't work:

      qt-cmake.bat -GNinja ..\src
      [...]
      cmake --build .
      [...]
      *C:\PROGRA~2\MICROS~2\2019\PROFES~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe  /nologo /TP -DQT_CREATOR -DQT_DISABLE_DEPRECATED_BEFORE=0x050900 -DQT_NO_CAST_TO_ASCII -DQT_NO_JAVA_STYLE_ITERATORS -DQT_RESTRICTED_CAST_FROM_ASCII -DQT_USE_QSTRINGBUILDER -DRELATIVE_DATA_PATH=\"../share/qtcreator\" -DRELATIVE_DOC_PATH=\"../share/doc/qtcreator\" -DRELATIVE_LIBEXEC_PATH=\"\" -DRELATIVE_PLUGIN_PATH=\"../lib/qtcreator/plugins\" -DUNICODE -DYAML_CPP_DLL -D_CRT_SECURE_NO_WARNINGS -D_UNICODE -Dyaml_cpp_EXPORTS -IC:\dev\creator\master\qt-6.4-msvc-2022-amd64\src\plugins\clangtools -IC:\dev\creator\master\qt-creator\src\plugins\clangtools -IC:\dev\creator\master\qt-creator\cmake\..\src\libs\3rdparty\yaml-cpp\include -IC:\dev\creator\master\qt-creator\src\plugins /DWIN32 /D_WINDOWS /GR /EHsc /Zi /Ob0 /Od /RTC1 -MDd /wd4573 /W3 /wd4251 /wd4275 -std:c++17 /showIncludes /Fosrc\plugins\clangtools\CMakeFiles\yaml-cpp.dir\__\__\libs\3rdparty\yaml-cpp\src\binary.cpp.obj /Fdsrc\plugins\clangtools\CMakeFiles\yaml-cpp.dir\ /FS -c C:\dev\creator\master\qt-creator\src\libs\3rdparty\yaml-cpp\src\binary.cpp
      C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.33.31629\include\yvals_core.h(635): fatal error C1189: #error:  STL1001: Unexpected compiler version, expected MSVC 19.32 or newer.
      

      What happens is that the compiler used to compile does not match the Windows SDK that is configured in the environment. And this is because the compiler path is hardcoded in the Qt installation, qt.toolchain.cmake:

          set(__qt_initial_c_compiler "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe")
          set(__qt_initial_cxx_compiler "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe")
          if(NOT DEFINED CMAKE_C_COMPILER AND EXISTS "${__qt_initial_c_compiler}")
              set(CMAKE_C_COMPILER "${__qt_initial_c_compiler}" CACHE STRING "")
          endif()
          if(NOT DEFINED CMAKE_CXX_COMPILER AND EXISTS "${__qt_initial_cxx_compiler}")
              set(CMAKE_CXX_COMPILER "${__qt_initial_cxx_compiler}" CACHE STRING "")
          endif()
      

      Because on my machine the original compiler exists, it is preferred over the default one in PATH, which would be:

      where cl.exe
      C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.33.31629\bin\Hostx64\x64\cl.exe
      

        For Gerrit Dashboard: QTBUG-108323
        # Subject Branch Project Status CR V

            qtbuildsystem Qt Build System Team
            kkohne Kai Köhne
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes