Skip to content

Build Task path error: .espressif/tools/* missing from ENV:PATH, "CMAKE_MAKE_PROGRAM is not set" (VSC-1813) #1723

@Smity

Description

@Smity

OS

Windows

Operating System version

Windows 11

Visual Studio Code version

1.106.3

ESP-IDF version

varies (usually 5.4.x)

Python version

3.11 (came shipped with IDF)

Doctor command output

report.txt

Extension

esp_idf_vsc_ext.log

Description

tl;dr: After working correctly for a while, the build task's enviroment variables stop being set.

I used to get the following error whenever I tried to use idf.py from the IDF terminal in VSCode:
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Apps > Advanced app settings > App execution aliases.
After following those instructions, the terminal immediatley started working. However, just as immediatley, the extension's build task (the button(s) in the screenshot) stopped working.
Image
Even after re-enabling the execution alias, now I can only build by typing idf.py build in the IDF terminal. The flash and monitor tasks still work, but the build task will fail if there's any compiling to do (otherwise it goes straight to the idf size outout). Also, the monitor task won't parse backtrace addresses, which makes debugging very difficult.

New projects work normally for a while (the button works), but things inevitably break after several builds. I haven't been able to find any spesific thing that triggers the problem. Sometimes it starts after a full clean, but not always; sometimes after a workspace-setting change, but not always; sometimes after switching IDF versions, but not always... you get the idea.

I set my pre-build task to $env:PATH -split ';' for debugging. There's an obvious diffrence when the build task is working versus when it isn't.

Working output:

c:\Users\Ben\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\debugCommand
c:\Users\Ben\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\copilotCli
c:\Repos\esp-idf\components\espcoredump
c:\Repos\esp-idf\components\partition_table
C:\Users\Ben\.espressif\tools\esp-rom-elfs\20241011
C:\Users\Ben\.espressif\tools\idf-git\2.39.2\cmd
C:\Users\Ben\.espressif\tools\xtensa-esp-elf-gdb\16.2_20250324\xtensa-esp-elf-gdb\bin
C:\Users\Ben\.espressif\tools\riscv32-esp-elf-gdb\16.2_20250324\riscv32-esp-elf-gdb\bin
C:\Users\Ben\.espressif\tools\xtensa-esp-elf\esp-14.2.0_20250730\xtensa-esp-elf\bin
C:\Users\Ben\.espressif\tools\esp-clang\esp-18.1.2_20240912\esp-clang\bin
C:\Users\Ben\.espressif\tools\riscv32-esp-elf\esp-14.2.0_20250730\riscv32-esp-elf\bin
C:\Users\Ben\.espressif\tools\esp32ulp-elf\2.38_20240113\esp32ulp-elf\bin
C:\Users\Ben\.espressif\tools\cmake\3.30.2\bin
C:\Users\Ben\.espressif\tools\openocd-esp32\v0.12.0-esp32-20250707\openocd-esp32\bin
C:\Users\Ben\.espressif\tools\ninja\1.12.1\
C:\Users\Ben\.espressif\tools\idf-exe\1.0.3\
C:\Users\Ben\.espressif\tools\ccache\4.11.2\ccache-4.11.2-windows-x86_64
C:\Users\Ben\.espressif\tools\dfu-util\0.11\dfu-util-0.11-win64
c:\Repos\esp-idf\tools
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Windows\System32\OpenSSH\
C:\Program Files\Microsoft SQL Server\150\Tools\Binn\
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
C:\Program Files\dotnet\
C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
C:\Program Files\Git\cmd
C:\Program Files\doxygen\bin
C:\Program Files\Graphviz\bin
C:\Users\Ben\AppData\Local\Microsoft\WindowsApps
C:\Users\Ben\AppData\Local\GitHubDesktop\bin
C:\Users\Ben\.dotnet\tools
C:\Users\Ben\.espressif\python_env\idf5.4_py3.11_env\Scripts
C:\Users\Ben\AppData\Local\Programs\Microsoft VS Code\bin
C:\Users\Ben\AppData\Local\GitHubDesktop\bin

Broken output:

C:\Users\Ben\.espressif\python_env\idf5.4_py3.11_env\Scripts
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Windows\System32\OpenSSH\
C:\Program Files\Microsoft SQL Server\150\Tools\Binn\
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
C:\Program Files\dotnet\
C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
C:\Program Files\Git\cmd
C:\Program Files\doxygen\bin
C:\Program Files\Graphviz\bin
C:\Users\Ben\AppData\Local\Microsoft\WindowsApps
C:\Users\Ben\AppData\Local\GitHubDesktop\bin
C:\Users\Ben\.dotnet\tools
C:\Users\Ben\.espressif\python_env\idf5.4_py3.11_env\Scripts
C:\Users\Ben\AppData\Local\Programs\Microsoft VS Code\bin
C:\Users\Ben\AppData\Local\GitHubDesktop\bin

Debug Message

When the build directory is empty, the output from the ESP-IF Compile Task is:

-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.50.0.windows.2")
CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!

 *  The terminal process "C:\Users\Ben\.espressif\tools\cmake\3.30.2\bin\cmake.exe '-G', 'Ninja', '-DPYTHON_DEPS_CHECKED=1', '-DESP_PLATFORM=1', '-B', 'c:\Users\Ben\desktop\pathtest\build', '-S', 'c:\Users\Ben\desktop\pathtest', '-DSDKCONFIG='c:\Users\Ben\desktop\pathtest\sdkconfig''" terminated with exit code: 1.

When the build directory is not empty (for example, if I called idf.py build from terminal first), the output is:

 *  Executing task: C:\Users\Ben\.espressif\tools\ninja\1.12.1\ninja.EXE  

[1/9] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/hello_world_main.c.obj
FAILED: esp-idf/main/CMakeFiles/__idf_main.dir/hello_world_main.c.obj 
ccache C:\Users\Ben\.espressif\tools\xtensa-esp-elf\esp-14.2.0_20250730\xtensa-esp-elf\bin\xtensa-esp32s3-elf-gcc.exe -DESP_PLATFORM -DIDF_VER=\"v5.4.2-570-g2c0a12286d-dirty\" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ -D_GLIBCXX_HAVE_POSIX_SEMAPHORE -D_GLIBCXX_USE_POSIX_SEMAPHORE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -IC:/Users/Ben/Desktop/pathtest/build/config -IC:/Repos/esp-idf/components/newlib/platform_include -IC:/Repos/esp-idf/components/freertos/config/include -IC:/Repos/esp-idf/components/freertos/config/include/freertos -IC:/Repos/esp-idf/components/freertos/config/xtensa/include -IC:/Repos/esp-idf/components/freertos/FreeRTOS-Kernel/include -IC:/Repos/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -IC:/Repos/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos -IC:/Repos/esp-idf/components/freertos/esp_additions/include -IC:/Repos/esp-idf/components/esp_hw_support/include -IC:/Repos/esp-idf/components/esp_hw_support/include/soc -IC:/Repos/esp-idf/components/esp_hw_support/include/soc/esp32s3 -IC:/Repos/esp-idf/components/esp_hw_support/dma/include -IC:/Repos/esp-idf/components/esp_hw_support/ldo/include -IC:/Repos/esp-idf/components/esp_hw_support/debug_probe/include -IC:/Repos/esp-idf/components/esp_hw_support/port/esp32s3/. -IC:/Repos/esp-idf/components/esp_hw_support/port/esp32s3/include -IC:/Repos/esp-idf/components/heap/include -IC:/Repos/esp-idf/components/heap/tlsf -IC:/Repos/esp-idf/components/log/include -IC:/Repos/esp-idf/components/soc/include -IC:/Repos/esp-idf/components/soc/esp32s3 -IC:/Repos/esp-idf/components/soc/esp32s3/include -IC:/Repos/esp-idf/components/soc/esp32s3/register -IC:/Repos/esp-idf/components/hal/platform_port/include -IC:/Repos/esp-idf/components/hal/esp32s3/include -IC:/Repos/esp-idf/components/hal/include -IC:/Repos/esp-idf/components/esp_rom/include -IC:/Repos/esp-idf/components/esp_rom/esp32s3/include -IC:/Repos/esp-idf/components/esp_rom/esp32s3/include/esp32s3 -IC:/Repos/esp-idf/components/esp_rom/esp32s3 -IC:/Repos/esp-idf/components/esp_common/include -IC:/Repos/esp-idf/components/esp_system/include -IC:/Repos/esp-idf/components/esp_system/port/soc -IC:/Repos/esp-idf/components/esp_system/port/include/private -IC:/Repos/esp-idf/components/xtensa/esp32s3/include -IC:/Repos/esp-idf/components/xtensa/include -IC:/Repos/esp-idf/components/xtensa/deprecated_include -IC:/Repos/esp-idf/components/lwip/include -IC:/Repos/esp-idf/components/lwip/include/apps -IC:/Repos/esp-idf/components/lwip/include/apps/sntp -IC:/Repos/esp-idf/components/lwip/lwip/src/include -IC:/Repos/esp-idf/components/lwip/port/include -IC:/Repos/esp-idf/components/lwip/port/freertos/include -IC:/Repos/esp-idf/components/lwip/port/esp32xx/include -IC:/Repos/esp-idf/components/lwip/port/esp32xx/include/arch -IC:/Repos/esp-idf/components/lwip/port/esp32xx/include/sys -IC:/Repos/esp-idf/components/spi_flash/include -mlongcalls  -fno-builtin-memcpy -fno-builtin-memset -fno-builtin-bzero -fno-builtin-stpcpy -fno-builtin-strncpy -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-error=extra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Og -fno-shrink-wrap -fmacro-prefix-map=C:/Users/Ben/Desktop/pathtest=. -fmacro-prefix-map=C:/Repos/esp-idf=/IDF -fstrininja: fatal: ReadFile: The handle is invalid.

ct-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/hello_world_main.c.obj -MF esp-idf\main\CMakeFiles\__idf_main.dir\hello_world_main.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/hello_world_main.c.obj -c C:/Users/Ben/Desktop/pathtest/main/hello_world_main.c
CreateProcess failed: The system cannot find the file specified.

 *  The terminal process "C:\Users\Ben\.espressif\tools\ninja\1.12.1\ninja.EXE" terminated with exit code: 1.

Other Steps to Reproduce

My Windows 10 machine works fine. My colleagues's Windows 11 machines work fine. They never had the issue relating to app execution aliases, though.

I have tried reinstalling

  • ESP-IDF
  • The vscode extension
  • vscode
    ...and I made sure to delete relavent cache files (at least the ones I could find) as I did so.

Manually adding the missing folders to my system PATH variable also didn't help the issue.

I also made copies of the project, %APPDATA%/code, and %USERPROFILE%/.vscdode folders and compared their contents from before and after the issue started on a new project, but didn't find anything that appeared useful.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug-reportBug Report from users on Github (don't use this tag manually, its supposed to be used via the issue)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions