Skip to content

Instantly share code, notes, and snippets.

@Jobians
Created May 11, 2025 23:34
Show Gist options
  • Save Jobians/b271a5f71f123c87b32269b18f78d827 to your computer and use it in GitHub Desktop.
Save Jobians/b271a5f71f123c87b32269b18f78d827 to your computer and use it in GitHub Desktop.
Fix for xtensa-esp32-elf-g++: not found on ARM64 Linux with PlatformIO | PackageException: Could not install package 'espressif/toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5' for 'linux_aarch64' system

Problem:

While building ESP32 projects on ARM64 (e.g., Raspberry Pi, Termux), PlatformIO shows this error:

xtensa-esp32-elf-g++: not found [Error 127]

Solution:

1. Download ARM64 toolchain:

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
  1. 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
  1. Retry PlatformIO build:

pio run


✅ This resolves the missing compiler error and allows ESP32 builds to complete on ARM64 Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment