Vscode-cmake-tools: "Unable to automatically determine compiler" message on configure/build

Created on 22 Jul 2018  Â·  11Comments  Â·  Source: microsoft/vscode-cmake-tools

Brief Issue Summary

When configuring or building a simple project using CMake Tools, the message

[rollbar] Unable to automatically determine compiler

appears many times in the output.

CMake Tools Log

[cms-client] Configuring using the "Visual Studio 15 2017" CMake generator
[cms-client] Configuring using the "Visual Studio 15 2017" CMake generator
[cmake] The C compiler identification is MSVC 19.14.26433.0
[cmake] The CXX compiler identification is MSVC 19.14.26433.0
[cmake] Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
[cmake] Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe -- works
[cmake] Detecting C compiler ABI info
[cmake] Detecting C compiler ABI info - done
[cmake] Detecting C compile features
[cmake] Detecting C compile features - done
[cmake] Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
[cmake] Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe -- works
[cmake] Detecting CXX compiler ABI info
[cmake] Detecting CXX compiler ABI info - done
[cmake] Detecting CXX compile features
[cmake] Detecting CXX compile features - done
[cmake] Configuring done
[cmake] Generating done
[cmake] CMake Warning:
[cmake]   Manually-specified variables were not used by the project:
[cmake] 
[cmake]     CMAKE_EXPORT_COMPILE_COMMANDS
[cmake] 
[cmake] 
[rollbar] Unable to automatically determine compiler {"lang":"CXX","fileGroup":{"isGenerated":true,"sources":["build/CMakeFiles/97dc947cd7023b12d597309df2d3148e/generate.stamp.rule"]}}
[rollbar] Unable to automatically determine compiler {"lang":"C","fileGroup":{"compileFlags":"/DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1  ","isGenerated":false,"language":"C","sources":["main.c"]}}
[rollbar] Unable to automatically determine compiler {"lang":"CXX","fileGroup":{"isGenerated":true,"sources":["build/CMakeFiles/97dc947cd7023b12d597309df2d3148e/generate.stamp.rule"]}}
[rollbar] Unable to automatically determine compiler {"lang":"C","fileGroup":{"compileFlags":"/DWIN32 /D_WINDOWS /W3 /MD /O2 /Ob2 /DNDEBUG  ","isGenerated":false,"language":"C","sources":["main.c"]}}
[rollbar] Unable to automatically determine compiler {"lang":"CXX","fileGroup":{"isGenerated":true,"sources":["build/CMakeFiles/97dc947cd7023b12d597309df2d3148e/generate.stamp.rule"]}}
[rollbar] Unable to automatically determine compiler {"lang":"C","fileGroup":{"compileFlags":"/DWIN32 /D_WINDOWS /W3 /MD /O1 /Ob1 /DNDEBUG  ","isGenerated":false,"language":"C","sources":["main.c"]}}
[rollbar] Unable to automatically determine compiler {"lang":"CXX","fileGroup":{"isGenerated":true,"sources":["build/CMakeFiles/97dc947cd7023b12d597309df2d3148e/generate.stamp.rule"]}}
[rollbar] Unable to automatically determine compiler {"lang":"C","fileGroup":{"compileFlags":"/DWIN32 /D_WINDOWS /W3 /MD /Zi /O2 /Ob1 /DNDEBUG  ","isGenerated":false,"language":"C","sources":["main.c"]}}

And if I build the project:

[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/example/build --config Debug --target example -- /m /property:GenerateFullPaths=true
[build] Microsoft (R) Build Engine version 15.7.180.61344 for .NET Framework
[build] Copyright (C) Microsoft Corporation. All rights reserved.
[build] 
[build] Build started 22/07/2018 17:16:48.
[build]      1>Project "C:\example\build\example.vcxproj" on node 1 (default targets).
[build]      1>Project "C:\example\build\example.vcxproj" (1) is building "C:\example\build\ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
[build]      2>PrepareForBuild:
[build]          Creating directory "x64\Debug\ZERO_CHECK\".
[build]          Creating directory "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\".
[build]        InitializeBuildStatus:
[build]          Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[build]        CustomBuild:
[build]          Checking Build System
[build]          CMake does not need to re-run because C:/example/build/CMakeFiles/generate.stamp is up-to-date.
[build]        FinalizeBuildStatus:
[build]          Deleting file "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
[build]          Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
[build]      2>Done Building Project "C:\example\build\ZERO_CHECK.vcxproj" (default targets).
[build]      1>PrepareForBuild:
[build]          Creating directory "example.dir\Debug\".
[build]          Creating directory "C:\example\build\Debug\".
[build]          Creating directory "example.dir\Debug\example.tlog\".
[build]        InitializeBuildStatus:
[build]          Creating "example.dir\Debug\example.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
[build]        CustomBuild:
[build]          Building Custom Rule C:/example/CMakeLists.txt
[build]          CMake does not need to re-run because C:/example/build/CMakeFiles/generate.stamp is up-to-date.
[build]        ClCompile:
[build]          C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\CL.exe /c /Zi /nologo /W3 /WX- /diagnostics:classic /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"example.dir\Debug\\" /Fd"example.dir\Debug\vc141.pdb" /Gd /TC /FC /errorReport:queue C:\example\main.c
[build]          main.c
[build]        Link:
[build]          C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\example\build\Debug\example.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/example/build/Debug/example.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/example/build/Debug/example.lib" /MACHINE:X64  /machine:x64 example.dir\Debug\main.obj
[build]          example.vcxproj -> C:\example\build\Debug\example.exe
[build]        FinalizeBuildStatus:
[build]          Deleting file "example.dir\Debug\example.tlog\unsuccessfulbuild".
[build]          Touching "example.dir\Debug\example.tlog\example.lastbuildstate".
[build]      1>Done Building Project "C:\example\build\example.vcxproj" (default targets).
[build] 
[build] Build succeeded.
[build]     0 Warning(s)
[build]     0 Error(s)
[build] 
[build] Time Elapsed 00:00:02.13
[build] Build finished with exit code 0
[rollbar] Unable to automatically determine compiler {"lang":"CXX","fileGroup":{"isGenerated":true,"sources":["build/CMakeFiles/97dc947cd7023b12d597309df2d3148e/generate.stamp.rule"]}}
[rollbar] Unable to automatically determine compiler {"lang":"C","fileGroup":{"compileFlags":"/DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1  ","isGenerated":false,"language":"C","sources":["main.c"]}}
[rollbar] Unable to automatically determine compiler {"lang":"CXX","fileGroup":{"isGenerated":true,"sources":["build/CMakeFiles/97dc947cd7023b12d597309df2d3148e/generate.stamp.rule"]}}
[rollbar] Unable to automatically determine compiler {"lang":"C","fileGroup":{"compileFlags":"/DWIN32 /D_WINDOWS /W3 /MD /O2 /Ob2 /DNDEBUG  ","isGenerated":false,"language":"C","sources":["main.c"]}}
[rollbar] Unable to automatically determine compiler {"lang":"CXX","fileGroup":{"isGenerated":true,"sources":["build/CMakeFiles/97dc947cd7023b12d597309df2d3148e/generate.stamp.rule"]}}
[rollbar] Unable to automatically determine compiler {"lang":"C","fileGroup":{"compileFlags":"/DWIN32 /D_WINDOWS /W3 /MD /O1 /Ob1 /DNDEBUG  ","isGenerated":false,"language":"C","sources":["main.c"]}}
[rollbar] Unable to automatically determine compiler {"lang":"CXX","fileGroup":{"isGenerated":true,"sources":["build/CMakeFiles/97dc947cd7023b12d597309df2d3148e/generate.stamp.rule"]}}
[rollbar] Unable to automatically determine compiler {"lang":"C","fileGroup":{"compileFlags":"/DWIN32 /D_WINDOWS /W3 /MD /Zi /O2 /Ob1 /DNDEBUG  ","isGenerated":false,"language":"C","sources":["main.c"]}}

Platform and Versions

  • Operating System: Windows 10
  • CMake Version: 3.12.0
  • VSCode Version: 1.25.1
  • CMake Tools Extension Version: 1.1.0
  • Compiler/Toolchain: Visual C++ 2017
IMPORTANT bug

Most helpful comment

Found the problem and have a fix. Should be released in a few hours along with a few other big fixes.

All 11 comments

I have the same issue with the same versions of everything.

This creates a lot of log spam for larger projects, I can't even tell if my build succeeded or not without scrolling for hundreds of lines. Everything else seems to work just fine though. Being able to suppress this would be nice if a fix isn't evident. Since this is an error it can't currently be suppressed with cmake.loggingLevel.

It seems that the Visual Studio generator doesn't add the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to the cmakecache file.

Adding them manually doesn't seem to help (both directly in CMakeCache.txt or as a cache variable in CMakeLists.txt) but I don't know if that's supposed to work either.

try

set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE FILEPATH "Compiler")
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER} CACHE FILEPATH "Compiler")

That works, I think I had forgotten to clear my cache or I used STRING instead of FILEPATH, but this is a good workaround for the time being, thanks!

This is a use case I _thought_ I had accounted for in 1.1.0. It's flooded my Rollbar account and I'll need to get this fixed because it's annoying to both me and all users using MSBuild/VS.

Found the problem and have a fix. Should be released in a few hours along with a few other big fixes.

@vector-of-bool This problem still exist in Ubuntu 16.04 with clang 3.8 compiler in version 1.1.1.

Can you paste the output from cmake -N -L in the build dir? (You may need to redact any sensitive info)

Are you using a toolchain file by chance?

Only sensitive info is left in my cache, no flags about CMAKE_CXX_FLAGS or CMAKE_CXX_COMPILER. I have to use the CACHE method mentioned above to avoid messages.

I'm seeing this problem in OSX + VSCode as well

username:build/ (master✗) $ cmake -N -L [16:20:54] -- Cache values CMAKE_BUILD_TYPE:STRING=Debug CMAKE_INSTALL_PREFIX:PATH=/usr/local CMAKE_TOOLCHAIN_FILE:FILEPATH=/<project_root>/armgcc.cmake

Was this page helpful?
0 / 5 - 0 ratings