While building ESP32 projects on ARM64 (e.g., Raspberry Pi, Termux), PlatformIO shows this error:
xtensa-esp32-elf-g++: not found [Error 127]
cd ~
wget https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-linux-arm64.tar.gz
tar -xzf xtensa-esp32-elf-*.tar.gz
- Add toolchain to PATH:
export PATH="$HOME/xtensa-esp32-elf/bin:$PATH
To make it permanent:
echo 'export PATH="$HOME/xtensa-esp32-elf/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
- Retry PlatformIO build:
pio run
✅ This resolves the missing compiler error and allows ESP32 builds to complete on ARM64 Linux.