vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Unspecified doesn't let CMake guess what compilers and environment to use

Open gerard-ryan-immersaview opened this issue 2 years ago • 6 comments

Brief Issue Summary

When the selected kit is [Unspecified] Unspecified (Let CMake guess what compilers and environment to use), -G Ninja is added to the CMake command and No CMAKE_C_COMPILER could be found.

CMake Tools Diagnostics

{
  "os": "win32",
  "vscodeVersion": "1.83.1",
  "cmtVersion": "1.15.31",
  "configurations": [
    {
      "folder": "c:\\Users\\gerard\\Desktop\\cmake-tools-mre",
      "cmakeVersion": "3.27.7",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": null
    }
  ]
}

Debug Log

[main] Configuring project: cmake-tools-mre 
[main] Saving open files before configure/build
[driver] Start configure 
[driver] Running pre-configure checks and steps
[cmakefileapi-driver] Configuring using kit
[cmakefileapi-driver] Invoking CMake C:\Program Files\CMake\bin\cmake.EXE with arguments ["--no-warn-unused-cli","-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-SC:/Users/gerard/Desktop/cmake-tools-mre","-Bc:/Users/gerard/Desktop/cmake-tools-mre/build","-G","Ninja"]
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/gerard/Desktop/cmake-tools-mre -Bc:/Users/gerard/Desktop/cmake-tools-mre/build -G Ninja
[proc]   with environment: {"ALLUSERSPROFILE":"C:\\ProgramData","APPDATA":"C:\\Users\\gerard\\AppData\\Roaming","APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"1","CHROME_CRASHPAD_PIPE_NAME":"\\\\.\\pipe\\crashpad_18836_OKEYJCUPEFXBSHSL","CLIENTNAME":"david","COMPUTERNAME":"EGYPTIAN-WINDOW","ComSpec":"C:\\Windows\\system32\\cmd.exe","CommonProgramFiles":"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files","CommonProgramW6432":"C:\\Program Files\\Common Files","DriverData":"C:\\Windows\\System32\\Drivers\\DriverData","ELECTRON_RUN_AS_NODE":"1","HOME":"C:\\Users\\gerard","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\gerard","LOCALAPPDATA":"C:\\Users\\gerard\\AppData\\Local","LOGONSERVER":"\\\\EGYPTIAN-WINDOW","NUMBER_OF_PROCESSORS":"28","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","OS":"Windows_NT","OneDrive":"C:\\Users\\gerard\\OneDrive","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC","POWERSHELL_DISTRIBUTION_CHANNEL":"MSI:Windows 10 Pro","PROCESSOR_ARCHITECTURE":"AMD64","PROCESSOR_IDENTIFIER":"AMD64 Family 25 Model 33 Stepping 0, AuthenticAMD","PROCESSOR_LEVEL":"25","PROCESSOR_REVISION":"2100","PSModulePath":"C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules","PUBLIC":"C:\\Users\\Public","Path":"C:\\Program Files (x86)\\Razer Chroma SDK\\bin;C:\\Program Files\\Razer Chroma SDK\\bin;C:\\Program Files (x86)\\Razer\\ChromaBroadcast\\bin;C:\\Program Files\\Razer\\ChromaBroadcast\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files (x86)\\Yarn\\bin\\;C:\\Windows\\system32\\config\\systemprofile\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\Git\\cmd;C:\\Program Files\\nodejs\\;C:\\Program Files\\Meson\\;C:\\Program Files\\CMake\\bin;C:\\Program Files\\PowerShell\\7\\;C:\\Program Files\\Docker\\Docker\\resources\\bin;C:\\Users\\gerard\\AppData\\Local\\Programs\\Python\\Python310\\Scripts\\;C:\\Users\\gerard\\AppData\\Local\\Programs\\Python\\Python310\\;C:\\Users\\gerard\\.cargo\\bin;C:\\Users\\gerard\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\gerard\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\gerard\\bin;C:\\Users\\gerard\\AppData\\Local\\Yarn\\bin;C:\\Program Files\\Beyond Compare 4;C:\\Users\\gerard\\AppData\\Roaming\\npm","ProgramData":"C:\\ProgramData","ProgramFiles":"C:\\Program Files","ProgramFiles(x86)":"C:\\Program Files (x86)","ProgramW6432":"C:\\Program Files","SESSIONNAME":"RDP-Tcp#0","SystemDrive":"C:","SystemRoot":"C:\\Windows","TEMP":"C:\\Users\\gerard\\AppData\\Local\\Temp","TMP":"C:\\Users\\gerard\\AppData\\Local\\Temp","USERDOMAIN":"EGYPTIAN-WINDOW","USERDOMAIN_ROAMINGPROFILE":"EGYPTIAN-WINDOW","USERNAME":"gerard","USERPROFILE":"C:\\Users\\gerard","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"C:\\Users\\gerard\\AppData\\Roaming\\Code\\CachedData\\f1b07bd25dfad64b0167beb15359ae573aecd2cc","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"C:\\Users\\gerard\\AppData\\Local\\Programs\\Microsoft VS Code","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"\\\\.\\pipe\\0ae14acbf34bd9585d14601c1a261927-1.83.1-main-sock","VSCODE_L10N_BUNDLE_LOCATION":"","VSCODE_NLS_CONFIG":"{\"locale\":\"en-us\",\"osLocale\":\"en-au\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"18836","WIX":"C:\\Program Files (x86)\\WiX Toolset v3.11\\","windir":"C:\\Windows"}
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is unknown
[cmake] -- The CXX compiler identification is unknown
[cmake] CMake Error at CMakeLists.txt:2 (project):
[cmake]   No CMAKE_C_COMPILER could be found.
[cmake] 
[cmake]   Tell CMake where to find the compiler by setting either the environment
[cmake]   variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
[cmake]   the compiler, or to the compiler name if it is in the PATH.
[cmake] 
[cmake] 
[cmake] CMake Error at CMakeLists.txt:2 (project):
[cmake]   No CMAKE_CXX_COMPILER could be found.
[cmake] 
[cmake]   Tell CMake where to find the compiler by setting either the environment
[cmake]   variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
[cmake]   to the compiler, or to the compiler name if it is in the PATH.
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/gerard/Desktop/cmake-tools-mre -Bc:/Users/gerard/Desktop/cmake-tools-mre/build -G Ninja exited with code: 1
[extension] [2304] cmake.configureAll finished (returned 1)

Additional Information

# CMakeLists.txt
cmake_minimum_required(VERSION 3.27)
project(cmake-tools-mre)

If I truly let CMake decide by running it on the CLI it finds the Compiler and environment I'd expect it to use.

PS C:\Users\gerard\Desktop\cmake-tools-mre> & "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/gerard/Desktop/cmake-tools-mre -Bc:/Users/gerard/Desktop/cmake-tools-mre/build
Not searching for unused variables given on the command line.
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.34.31947.0
-- The CXX compiler identification is MSVC 19.34.31947.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (4.4s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/gerard/Desktop/cmake-tools-mre/build

gerard-ryan-immersaview avatar Oct 25 '23 04:10 gerard-ryan-immersaview

@gcampbell-msft is there any more info needed to repro?

Just tried again, and this CMakeLists.txt in a folder of its own

# CMakeLists.txt
cmake_minimum_required(VERSION 3.27)
project(cmake-tools-mre)

gave me

[main] Configuring project: cmake-tools-mre 
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/gerard/Desktop/cmake-tools-mre -Bc:/Users/gerard/Desktop/cmake-tools-mre/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is unknown
[cmake] -- The CXX compiler identification is unknown
[cmake] CMake Error at CMakeLists.txt:2 (project):
[cmake]   No CMAKE_C_COMPILER could be found.
[cmake] 
[cmake]   Tell CMake where to find the compiler by setting either the environment
[cmake]   variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
[cmake]   the compiler, or to the compiler name if it is in the PATH.
[cmake] 
[cmake] 
[cmake] CMake Error at CMakeLists.txt:2 (project):
[cmake]   No CMAKE_CXX_COMPILER could be found.
[cmake] 
[cmake]   Tell CMake where to find the compiler by setting either the environment
[cmake]   variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
[cmake]   to the compiler, or to the compiler name if it is in the PATH.
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/gerard/Desktop/cmake-tools-mre -Bc:/Users/gerard/Desktop/cmake-tools-mre/build -G Ninja exited with code: 1

whereas running

 "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/gerard/Desktop/cmake-tools-mre -Bc:/Users/gerard/Desktop/cmake-tools-mre/build

in the same folder gave me a successful

"C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/gerard/Desktop/cmake-tools-mre -Bc:/Users/gerard/Desktop/cmake-tools-mre/build
Not searching for unused variables given on the command line.
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.39.33523.0
-- The CXX compiler identification is MSVC 19.39.33523.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features       
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features       
-- Detecting CXX compile features - done
-- Configuring done (4.8s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/gerard/Desktop/cmake-tools-mre/build

CMake Tools Diagnostics

{
  "os": "win32",
  "vscodeVersion": "1.88.1",
  "cmtVersion": "1.17.17",
  "configurations": [
    {
      "folder": "c:\\Users\\gerard\\Desktop\\cmake-tools-mre",
      "cmakeVersion": "3.29.2",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": null
    }
  ]
}

gerard-ryan-immersaview avatar Apr 18 '24 00:04 gerard-ryan-immersaview

@gerard-ryan-immersaview I still can't reproduce the problem after following your tips, am I going about it the wrong way? Are you able to give some advice? image

v-frankwang avatar Apr 19 '24 09:04 v-frankwang

@gerard-ryan-immersaview I still can't reproduce the problem after following your tips, am I going about it the wrong way? Are you able to give some advice? image

And you configured the kit to be unspecified?

image

I noticed that you use the CMake version that comes with Visual Studio and not the direct one too.

gerard-ryan-immersaview avatar Apr 22 '24 00:04 gerard-ryan-immersaview

@gcampbell-msft @gerard-ryan-immersaview Following the steps given by the user, this issue we can reproduce on top of the latest VSCode and you can get some information below:

ENV: VS Code: 1.88.1 CMake tools: 1.18.29 C/C++:1.20.2

Repro steps recording: 1. Create a folder named "cmake-tools-mre". 2. Add to it a CMakeLists.txt file containing the following code: cmake_minimum_required(VERSION 3.27) project(cmake-tools-mre) 3. Open it with VS Code. 4. Executing the CMake: configure command 5. Configured the kit to be Unspecified repro1

v-frankwang avatar Apr 24 '24 06:04 v-frankwang

@gerard-ryan-immersaview Does this issue still reproduce if you clear the setting cmake.generator? Thanks, adding this issue to the backlog so we can track better and investigate when we can.

gcampbell-msft avatar Jun 24 '24 16:06 gcampbell-msft

@gerard-ryan-immersaview Does this issue still reproduce if you clear the setting cmake.generator? Thanks, adding this issue to the backlog so we can track better and investigate when we can.

Yes

gerard-ryan-immersaview avatar Jun 25 '24 01:06 gerard-ryan-immersaview

@gerard-ryan-immersaview Thank you very much for your reply, we have added this issue to the backlog and will follow up with our developers to deal with this issue and will be the first to add a comment if there is any progress!

v-frankwang avatar Jul 01 '24 06:07 v-frankwang

Hey @v-frankwang this issue should now be fixed in the latest pre-release :)

snehara99 avatar Jul 15 '24 17:07 snehara99

@snehara99 Thank you very much for your reply, I verified the issue on latest pre-release: v1.19.20 (pre-release) and it was fixed.

ENV: CMake Tools: v1.19.21 (pre-release) vscode: 1.19.1 (user setup) C/C++:v1.21.1(pre-release)

image

v-frankwang avatar Jul 16 '24 02:07 v-frankwang