This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

VS Code: Unable to determine what CMake generator to use.

When I create a new project from samples in VS Code I get this error
[variant] Loaded new set of variants
[kit] Successfully loaded 9 kits from C:\Users\Andrea\AppData\Local\CMakeTools\cmake-tools-kits.json
[main] Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json, your Kit configuration or PATH variable. Error: No usable generator found.
[main] Configuring folder: hello_world
[main] Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json, your Kit configuration or PATH variable. Error: No usable generator found.
How can I fix it?
  • What is xx in cmake-3.xx (for example, cmake-3.20) directory inside your ncs\1.8.0\toolchain\opt\share folder?

    20

    What is the last version of the rst file which is visible in your ncs\1.8.0\toolchain\opt\share\cmake-3.xx\Help\release folder?  

    3.20.rst

    Please open your Toolchain Manager, press down arrow and choose "Open Command Prompt". Type "cmake --version" command and share the output of the command.

    C:\Users\Andrea\ncs\v1.8.0>cmake --version
    cmake version 3.20.5
    
    CMake suite maintained and supported by Kitware (kitware.com/cmake).

    It seems that in VS Code there isn't any reference to the toolchain.

  • Hi Andrea,

    Please ensure that you are not running any unnecessary extensions (such as Expressiff, PlatformIO, ...) on your laptop. If you still do, please remove them and try again.

    In addition, please send me the output of "Generate Support Information". In Windows start by pressing Ctrl-Shift-P (in Mac Cmd-Shift-P) and type "Generate Support Information". The report will be opened in the Output Pane. Please copy everything and send it back to me.

    Best regards,
    Dejan

  • Please ensure that you are not running any unnecessary extensions

    I unistalled the unnecessary extensions (Espressiff in my case) but I have other extensions I need (PlatformIO, Flutter, Dart). I thought to unistall VS Code and do a clean installation, but before I want to try and find a painless solution. I don't understand why the nRF extension doesn't finds the toolchain path if I set it in the Quick Setup page. Is a OS environment variable issue? I don't know how the nRF extension works but seems to be a bug.

    In addition, please send me the output of "Generate Support Information".

    Here the output

    IMPORTANT: The data below could contain sensitive or confidential information about your environment.
    If you do not wish this to be seen by others, please make sure to remove it before sharing.
    
    For help and support, visit the Nordic DevZone at https://devzone.nordicsemi.com/.
    
    {
      "platform": {
        "os": "win32",
        "osVersion": "Windows 10 Home",
        "osKernel": "10.0.19043",
        "vscode": "1.63.2",
        "electron": "13.5.2",
        "node": "v14.16.0"
      },
      "system": {
        "date": "2022-01-28T19:00:32.188Z",
        "vscodeRoot": "c:\\Users\\Andrea\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app",
        "nrfConnectForDesktopInstalled": true,
        "vscodeUptime": "00:01:11",
        "osUptime": "03:38:05",
        "cpu": {
          "model": "Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz",
          "speed": "2592 MHz",
          "count": 6
        },
        "memory": {
          "total": "15.85 GB",
          "free": "9.84 GB"
        }
      },
      "workspace": {
        "name": null,
        "workspaceFile": null,
        "folders": []
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2021.12.137",
            "path": "c:\\Users\\Andrea\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2021.12.137",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": {
            "version": "2021.11.7",
            "path": "c:\\Users\\Andrea\\.vscode\\extensions\\nordic-semiconductor.nrf-terminal-2021.11.7",
            "isActive": true
          },
          "nordic-semiconductor.devicetree": null,
          "nordic-semiconductor.kconfig": null
        },
        "external": {
          "marus25.cortex-debug": "1.2.2",
          "ms-vscode.cpptools": "1.8.1",
          "ms-vscode-remote.remote-wsl-recommender": "0.0.12",
          "ms-vscode.js-debug": "1.62.0",
          "ms-vscode.js-debug-companion": "1.0.15",
          "ms-vscode.references-view": "0.0.81",
          "ms-vscode.vscode-js-profile-table": "0.0.18",
          "Dart-Code.dart-code": "3.32.0",
          "Dart-Code.flutter": "3.32.0",
          "MS-CEINTL.vscode-language-pack-it": "1.63.3",
          "ms-python.python": "2021.12.1559732655",
          "ms-python.vscode-pylance": "2022.1.5",
          "ms-toolsai.jupyter": "2021.11.1001550889",
          "ms-toolsai.jupyter-keymap": "1.0.0",
          "ms-toolsai.jupyter-renderers": "1.0.4",
          "ms-vscode.cmake-tools": "1.9.2",
          "PKief.material-icon-theme": "4.12.1",
          "platformio.platformio-ide": "2.4.0",
          "trond-snekvik.gnu-mapfiles": "1.1.0",
          "twxs.cmake": "0.0.17"
        }
      },
      "tools": {
        "C:\\Program Files\\SEGGER\\JLink\\JLink.exe": "7.58b",
        "nrfjprog": "Not found",
        "cmake": "Not found",
        "west": "Not found",
        "python": "Not found",
        "ninja": "Not found",
        "gperf": "Not found",
        "dtc": "Not found",
        "gnuarmemb": "Not found",
        "gn": "Not found",
        "git": "Not found"
      },
      "connectedDevices": [],
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "${nrf-connect.sdk:1.8.0}",
          "toolchain": {
            "path": "${nrf-connect.toolchain:1.8.0}"
          },
          "ozonePath": "",
          "applications": [],
          "jlink": {
            "rtosPlugin": ""
          },
          "kconfig": {
            "interface": "kconfig"
          },
          "welcome": {
            "showOnStartup": false
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "enableTelemetry": true
        },
        "nordic-semiconductor.nrf-terminal": {
          "terminalMode": "character"
        },
        "nordic-semiconductor.devicetree": {
          "modules": [
            "${zephyrBase}",
            "${zephyrBase}/../nrf",
            "."
          ],
          "zephyr": "",
          "ctxFile": "",
          "defaultBoard": ""
        },
        "nordic-semiconductor.kconfig": {
          "root": "",
          "env": {},
          "cfiles": true,
          "disable": false,
          "zephyr": {
            "base": ""
          },
          "python": ""
        },
        "marus25.cortex-debug": {
          "armToolchainPath": null,
          "armToolchainPrefix": "arm-none-eabi",
          "gdbPath": null,
          "objdumpPath": null,
          "JLinkGDBServerPath": null,
          "openocdPath": null,
          "pyocdPath": null,
          "PEGDBServerPath": null,
          "stutilPath": null,
          "stlinkPath": null,
          "stm32cubeprogrammer": null,
          "enableTelemetry": true,
          "flattenAnonymous": false,
          "registerUseNaturalFormat": true,
          "variableUseNaturalFormat": true,
          "dbgServerLogfile": null,
          "showDevDebugOutput": "none"
        }
      },
      "environment": {
        "westExe": "c:\\Users\\Andrea\\ncs\\v1.8.0\\toolchain\\opt\\bin\\Scripts\\west.exe",
        "westEnv": {
          "ELECTRON_RUN_AS_NODE": "1",
          "HOME": "C:\\Users\\Andrea\\AppData\\Roaming\\SPB_Data",
          "HOMEDRIVE": "C:",
          "HOMEPATH": "\\Users\\Andrea",
          "Path": "c:\\Users\\Andrea\\ncs\\v1.8.0\\toolchain\\mingw64\\bin;c:\\Users\\Andrea\\ncs\\v1.8.0\\toolchain\\mingw64\\libexec\\git-core;c:\\Users\\Andrea\\ncs\\v1.8.0\\toolchain\\opt\\bin;c:\\Users\\Andrea\\ncs\\v1.8.0\\toolchain\\opt\\bin\\Scripts;undefined",
          "PATH": "C:\\Program Files (x86)\\Common Files\\Intel\\Shared Libraries\\redist\\intel64\\compiler;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C:\\Program Files\\Microchip\\xc16\\v1.50\\bin;C:\\Program Files (x86)\\Microchip\\xc32\\v2.30\\bin;C:\\Program Files (x86)\\National Instruments\\Shared\\LabVIEW CLI;C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin\\;C:\\Program Files\\IVI Foundation\\VISA\\Win64\\Bin\\;C:\\Program Files (x86)\\Microsoft SQL Server\\80\\Tools\\Binn\\;C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\100\\DTS\\Binn\\;C:\\Program Files (x86)\\Microchip\\xc16\\v1.50\\bin;C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\;C:\\Program Files\\Microchip\\xc8\\v2.20\\bin;C:\\Program Files (x86)\\IVI Foundation\\IVI\\bin;C:\\Program Files\\IVI Foundation\\IVI\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\Gpg4win\\..\\GnuPG\\bin;C:\\Program Files\\Polyspace\\R2020a\\runtime\\win64;C:\\Program Files\\Polyspace\\R2020a\\bin;C:\\Qwt-6.1.5\\lib;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\dotnet\\;C:\\Program Files\\PuTTY\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Microchip\\xc32\\v3.01\\bin;C:\\Program Files\\Microchip\\xc16\\v1.70\\bin;C:\\Program Files\\Microchip\\xc8\\v2.32\\bin;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\nodejs\\;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Users\\Andrea\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\\;C:\\Users\\Andrea\\AppData\\Local\\Programs\\Python\\Python39\\;C:\\Cadence\\SPB_16.6\\tools\\pcb\\bin;C:\\Cadence\\SPB_16.6\\tools\\fet\\bin;C:\\Cadence\\SPB_16.6\\openaccess\\bin\\win32\\opt;C:\\Cadence\\SPB_16.6\\tools\\bin;C:\\Cadence\\SPB_16.6\\tools\\capture;C:\\Cadence\\SPB_16.6\\tools\\pspice;C:\\Users\\Andrea\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Flutter-SDK\\bin;C:\\Users\\Andrea\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\Andrea\\.dotnet\\tools;C:\\Users\\Andrea\\AppData\\Roaming\\npm;",
          "ZEPHYR_BASE": "c:\\Users\\Andrea\\ncs\\v1.8.0\\zephyr",
          "GNUARMEMB_TOOLCHAIN_PATH": "c:\\Users\\Andrea\\ncs\\v1.8.0\\toolchain\\opt",
          "ZEPHYR_TOOLCHAIN_VARIANT": "gnuarmemb",
          "PYTHONPATH": "c:\\Users\\Andrea\\ncs\\v1.8.0\\toolchain\\opt\\bin;c:\\Users\\Andrea\\ncs\\v1.8.0\\toolchain\\opt\\bin\\Lib;c:\\Users\\Andrea\\ncs\\v1.8.0\\toolchain\\opt\\bin\\Lib\\site-packages",
          "Python3_ROOT": "c:\\Users\\Andrea\\ncs\\v1.8.0\\toolchain\\opt\\bin"
        },
        "toolchainPath": "c:\\Users\\Andrea\\ncs\\v1.8.0\\toolchain",
        "toolchainBinPath": "c:\\Users\\Andrea\\ncs\\v1.8.0\\toolchain\\opt\\bin",
        "toolchainVersion": "1.8.0"
      },
      "terminal": {
        "shell": null,
        "defaultProfile": null
      }
    }
    
    

  • Help me guys. I've unistalled  completely VS Code with all its settings and extensions deleting the

    %UserProfile%\.vscode
    %AppData%\CodeCode

    folders. So I started with a completly blank environment. But again when I create a new application with the nRF extension and build it, the environment doesn't find a vali cMake

    > Executing task: nRF Connect: Generate config nrf52833dk_nrf52833 for c:\Users\Andrea\Documents\NordicApps\blinky <
    
    Building blinky
    west build --build-dir c:\Users\Andrea\Documents\NordicApps\blinky\build_3 c:\Users\Andrea\Documents\NordicApps\blinky --pristine --board nrf52833dk_nrf52833 -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y
    
    -- west build: generating a build system
    FATAL ERROR: CMake is not installed or cannot be found; cannot build

    When I launched the VS Code for the first time from the nRF Toolchain Manager (after installed all the extensions needed) the program asked me to install the cMake Tools extension to configure the project. After that the cMake Toll asked me

    but if I choose 'yes' I can't see the kit of nRF toolchain

    . For this reason I don't select anyting but when I add building configuration to my application and click on the 'Build Configuration' button I get again the error above.


    I repeat that on my another personal notebook I didn't have any problem. I don't understand why.


    The situation begins to be frustrating and I'm thinking to change approach. Do you have any suggestion?

  • Hi,

    You are experiencing a Windows path problem which would need to be investigated further.
    I have reported the issue and waiting for a reply.

    One thing you could try would be to disable CMake Tools extension.
    Note also that you can enable/disable extensions in VS Code in specific workspaces. In this way, you can avoid conflicting extensions without the need to uninstall them.

    Best regards,
    Dejan

Related