nrfutil toolchain-manager launch --terminal does not work on Windows

My understanding is that the Toolchain Manager provided by the nRF Connect GUI desktop app is deprecated. I have uninstalled all toolchains and SDKs installed by that app and reinstalled them using the nRF Connect extension in VS Code. My understanding also is that I can still get CLI functionality using nrfutil.

I downloaded the nrfutil executable and made it available via the system path. I have also installed the "toolchain-manager" and "device" modules for nrfutil. I am now trying to start an interactive terminal with proper build environment set up. No matter what I do, I just get immediately dumped back to the Windows command prompt. I have tried both from cmd.exe and Git bash.

When I do use `nrfutil toolchain-manager launch --shell` in WSL/Ubuntu, it works properly and I get a new shell environment.

Here is trace log output from the Windows version of nrfutil after attempting to start a shell. The shell is closed within 50ms with exit code 0. There is no other error information.

[2024-03-27T15:24:30.667Z] [nrfutil-toolchain-manager] INFO - nrfutil-toolchain-manager (version = 0.14.2, platform = x86_64-pc-windows-msvc) invoked with launch --log-level trace --log-output=file --ncs-version v2.5.0 --terminal
[2024-03-27T15:24:30.668Z] [nrfutil-toolchain-manager] INFO - Retrieving toolchains from file C:\ncs\toolchains\toolchains.json
[2024-03-27T15:24:30.668Z] [nrfutil-toolchain-manager] TRACE - Opening and locking file: C:\ncs\toolchains\toolchains.json
[2024-03-27T15:24:30.714Z] [nrfutil-toolchain-manager] INFO - Exit code: exit code: 0

Here is a similar log from the Linux version of nrfutil running in WSL2/Ubuntu 22.04. The shell is not closed until I type `exit` three seconds later and this time it has an exit code of 127.

[2024-03-27T15:25:26.403Z] [nrfutil-toolchain-manager] INFO - nrfutil-toolchain-manager (version = 0.14.1, platform = x86_64-unknown-linux-gnu) invoked with launch --log-level trace --log-output=file --ncs-version v2.5.0 --shell
[2024-03-27T15:25:26.403Z] [nrfutil-toolchain-manager] DEBUG - Constructing the configuration from the defaults
[2024-03-27T15:25:26.403Z] [nrfutil-toolchain-manager] DEBUG - Current config: Config { install_dir: "/home/afont/ncs", toolchain_index: None }
[2024-03-27T15:25:26.403Z] [nrfutil-toolchain-manager] INFO - Retrieving toolchains from file /home/afont/ncs/toolchains/toolchains.json
[2024-03-27T15:25:26.403Z] [nrfutil-toolchain-manager] TRACE - Opening and locking file: /home/afont/ncs/toolchains/toolchains.json
[2024-03-27T15:25:29.736Z] [nrfutil-toolchain-manager] INFO - Exit code: exit status: 127

Is there something I am doing wrong that is preventing this from working in Windows?

  • Hello,

    I have seen the same issues that you are seeing. Is it an option to use the nRF Connect for Desktop -> Toolchain Manager -> Generate environment script ?

    At least until we get out the bugs in the nrfutil -> toolchain-manager, I think this is the way to go.

    After generating the environment script, you can rename and put this somewhere in your path. I use this to switch between NCS versions, and I think it is faster than using the nrfutil method for now. (although I understand that it may not be as good in a scripting environment), as it requires some clicking to set it up for each NCS version.)

    Best regards,

    Edvin

  • 1: Can you please check what nrfutil says if you enter:

    "nrfutil toolchain-manager list"?

    2: And what about if you enter:

    "cmd.exe /c start"?

    Does it open a new terminal? Or does it open and close immediately?

    3: And finally, what windows version do you have?

    Best regards,

    Edvin

  • Yes, this works and it's what I've been using already. I just wasn't sure about it since it involves mixing use of the VS Code/nrfutil method of managing toolchains with the nRF Connect desktop app.

  • Executing "cmd.exe /c start" from Windows run dialog (i.e. dialog opened by Windows-x, r). This opens a cmd.exe shell that remains open.

    aaronf@DESKTOP-RNAG27J MINGW64 ~/Documents/Learning/NCS/ncs-low-power (ncs-v2.5.0)
    $ nrfutil toolchain-manager list
      Version  Toolchain
      v2.5.0   C:\ncs\toolchains\c57af46cb7
      v2.2.0   C:\ncs\toolchains\v2.2.0
    * v2.6.0   C:\ncs\toolchains\cf2149caf2

    Edition    Windows 10 Pro
    Version    22H2
    Installed on    ‎4/‎10/‎2021
    OS build    19045.4170
    Experience    Windows Feature Experience Pack 1000.19054.1000.0

  • Additional info:

    If I run "cmd.exe /c start" from within Git Bash (run from Windows Terminal app) it opens a subshell in the same window. I can then "exit" back to Git Bash.

    If I run "cmd.exe /c start" from a cmd.exe window, it spawns a new cmd.exe window.

Related