Qt Creator fails to open a CMake project due to a wrong link.exe path

1

I upgraded Visual Studio 2017 recently and now cannot open a CMake project in Qt Creator 4.8.2.

CMake succeeds to test the compiler when running from cmd.exe but fails in Qt Creator:

Running "C:\Program Files\CMake\bin\cmake.exe -E server "--pipe=\\.\pipe\{b2399ce2-b8c1-4992-94b7-57b65efed70f}" --experimental" in D:\checkout\mateju\integrace\util\itex\build_Qt5-Release.
Starting to parse CMake project.
The C compiler identification is MSVC 19.16.27027.1
The CXX compiler identification is MSVC 19.16.27027.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message):
  The C compiler "C:/Program Files (x86)/Microsoft Visual
  Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe" is
  not able to compile a simple test program.

  It fails with the following output:

   Change Dir: D:/checkout/mateju/integrace/util/itex/build_Qt5-Release/CMakeFiles/CMakeTmp



  Run Build Command:"nmake" "/NOLOGO" "cmTC_1344c\fast"

    "C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"
  -f CMakeFiles\cmTC_1344c.dir\build.make /nologo -L
  CMakeFiles\cmTC_1344c.dir\build

  Building C object CMakeFiles/cmTC_1344c.dir/testCCompiler.c.obj


    C:\PROGRA~2\MICROS~2\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\HostX64\x64\cl.exe
  @C:\Users\MATEJU~1\AppData\Local\Temp\nmEB0D.tmp

  testCCompiler.c

  Linking C executable cmTC_1344c.exe

    "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe
  --intdir=CMakeFiles\cmTC_1344c.dir --manifests -- "C:\Program Files
  (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\link.exe"
  /nologo @CMakeFiles\cmTC_1344c.dir\objects1.rsp
  @C:\Users\MATEJU~1\AppData\Local\Temp\nmEC75.tmp

  LINK Pass 1 failed to run.

  NMAKE : fatal error U1077: "C:\Program Files\CMake\bin\cmake.exe":
  return code 0xffffffff

  Stop.

  NMAKE : fatal error U1077: "C:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe":
  return code 0x2

  Stop.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


Configuring incomplete, errors occurred!
See also "D:/checkout/mateju/integrace/util/itex/build_Qt5-Release/CMakeFiles/CMakeOutput.log".
See also "D:/checkout/mateju/integrace/util/itex/build_Qt5-Release/CMakeFiles/CMakeError.log".
CMake Project parsing failed.

As you can see, the compiler path is:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64

However, it’s looking for the linker in the path:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64

So my question is: How can I update the linker path to (the only existing) 14.16.27023? Or what else should I do to continue using CMake in Qt Creator?

I’ve tried to find a corresponding option in my Qt Creator Compiler options but it claims to use the same vcvarsall.bat call which works well on command-line…

D:\build>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.8
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

D:\build>link
Microsoft (R) Incremental Linker Version 14.16.27027.1
Copyright (C) Microsoft Corporation.  All rights reserved.
<and so on...>

I’ve tried the following steps without any success:

  • add C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64 to PATH as the answer to a similar question suggests
  • launch Qt Creator from cmd.exe after running vcvarsall.bat in the same window
  • upgrade CMake to the latest stable version (3.14.1)
  • install and try in Qt Creator 4.9.0-rc1
  • search for the string 14.10.25017
    • in the Windows Registry – no results
    • in the Qt Creator directory
      • no configuration files found
      • found .pdb and .lib files which likely only means they were built using this version of Visual Studio
    • in C:\Program Files (x86)\Microsoft Visual Studio – no results
    • in C:\Program Files (x86)\Windows Kits – no results
windows
visual-studio
cmake
visual-studio-2017
qt-creator
asked on Stack Overflow Apr 1, 2019 by Melebius • edited Apr 2, 2019 by Melebius

1 Answer

0

After several unsuccessful guesses mentioned in the question, I succeeded to open, build and run my project after I issued

Build > Clear CMake Configuration

in the menu of Qt Creator.

answered on Stack Overflow Apr 2, 2019 by Melebius • edited Apr 15, 2019 by Melebius

User contributions licensed under CC BY-SA 3.0