[Help Needed] ESP32-H2 Toolchain Issue – Unable to Compile a Simple Program on Windows 10

kpate102
Posts: 2
Joined: Sun Feb 16, 2025 1:51 am

[Help Needed] ESP32-H2 Toolchain Issue – Unable to Compile a Simple Program on Windows 10

Postby kpate102 » Sun Feb 16, 2025 2:01 am

System Details
OS: Windows 10
ESP-IDF Version: v5.4
Target: ESP32-H2
Python Version: 3.11.2
CMake Version: 3.30.2
Ninja Version: 1.12.1
Toolchains Installed:
riscv32-esp-elf (esp-14.2.0_20241119)
xtensa-esp-elf (esp-14.2.0_20241119)
esp-clang (esp-18.1.2_20240912)

I'm trying to build a project for an ESP32-H2 target on Windows 10, but idf.py build fails with the error:
CMake Error at CMakeTestCCompiler.cmake:67 (message):
The C compiler

"B:/Applications/Espressif/ESP/tools/riscv32-esp-elf/esp-14.2.0_20241119/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe"

is not able to compile a simple test program.

B:/Applications/Espressif/ESP/tools/riscv32-esp-elf/esp-14.2.0_20241119/riscv32-esp-elf/bin/ld.exe: unrecognized option '--major-image-version'
ld.lld: error: unable to find library -lkernel32
ld.lld: error: unable to find library -luser32
ld.lld: error: unable to find library -lgdi32
...
collect2.exe: error: ld returned 1 exit status


Troubleshooting Steps Taken
1) Verified Toolchain Installation
  • python idf_tools.py list confirms riscv32-esp-elf is installed.
  • where riscv32-esp-elf-gcc returns nothing, even after modifying $Env:PATH.
  • Manually checking B:\Applications\Espressif\ESP\tools\riscv32-esp-elf\esp-14.2.0_20241119\riscv32-esp-elf\bin confirms riscv32-esp-elf-gcc.exe exists.
2) Manually Set Path Variables
  • I tried adding riscv32-esp-elf\bin to $Env: PATH but where riscv32-esp-elf-gcc still returns nothing.
3) Cleaned & Reconfigured Project
  • Ran Remove-Item -Recurse -Force B:\Applications\ESP\build
  • Exported ESP-IDF environment using export.ps1
  • Ran idf.py set-target esp32h2
  • idf.py build still fails with the same ld.exe errors.
At this point, I honestly do not know why it does not work. I am currently trying to work on a previous team's work from early 2024. I have tried to install and use via Vscode Terminal, and Extension (With Ubuntu).

When using the VScode Ubuntu via terminal I get the same Issue.
It does not build the Flash project properly

When using the extension, it does not recognize my EPS32 board on the COM3 port.
It will build, clean, and all of that, however, will not recognize my board

When using the Espressif program directly I get the issues mentioned above. I have everything installed in a separate folder on an extra internal hard drive that I installed (My Original C drive ran out of storage). I have also replaced the motherboard on my computer 4 weeks ago.

I am developing using the ESP32-H2-DevKitM-1 board. I have been at this for 3.5 weeks. Nothing is working. PLEASE HELP

Who is online

Users browsing this forum: No registered users and 135 guests