Skip to content

Tools installer installs ninja-build x86_64 on linux arm64 (IDFGH-16886) (VSC-1810) #1722

@moefear85

Description

@moefear85

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

latest release

Operating System used.

Linux

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

None

What is the expected behavior?

every time I run esp-idf menuconfig or build or even reconfigure the extension in vscode, I get the following error:

CMake Error at /toolkits/espressif/v5.5/esp-idf/tools/cmake/project.cmake:589 (__project):

Running


'/toolkits/espressif/v5.5/tools/tools/ninja/1.12.1/ninja' '--version'


failed with:


/toolkits/espressif/v5.5/tools/tools/ninja/1.12.1/ninja: 1: Syntax error: "(" unexpected

this doesn't happen from the cli, only in the vscode extension

What is the actual behavior?

When installing esp-idf through the vscode extension, the resulting setup installs ninja x86_64 even though all other tools are correctly arm64 on armbian. A test build from the cli works fine, but through the vs code extension it fails. Hence I don't know if it is an installer or extension issue.

Steps to reproduce.

Gemini caught & fixed this:

This error is almost certainly a CPU architecture mismatch related to your Orange Pi 5 Plus.

The error Syntax error: "(" unexpected usually happens when an ARM64 system (like your Orange Pi running Kubuntu) tries to execute an x86_64 (Intel/AMD) binary. The kernel rejects the binary format, so the shell tries to read it as a script, hits the binary data (the ELF header), and crashes with a syntax error.

It implies that the ninja binary located at /toolkits/espressif/v5.5/tools/tools/ninja/1.12.1/ninja is meant for a standard PC, not your Orange Pi.

Here is how to fix this in VS Code.

1. Verify the Architecture Mismatch

First, confirm the issue by checking the file type of the binary causing the crash. Open your terminal and run:
Bash

file /toolkits/espressif/v5.5/tools/tools/ninja/1.12.1/ninja

    If it says: ELF 64-bit LSB executable, x86-64... -> This is the problem. It is an Intel binary.

    If it says: ELF 64-bit LSB executable, ARM aarch64... -> The binary is correct, but might be corrupted (less likely given the specific error).

2. The Fix: Replace with System Ninja

Since you are on Kubuntu, the easiest fix is to use the system-provided ninja, which is guaranteed to be compiled for your Orange Pi's ARM architecture.

    Install the system ninja (if not already installed):
    Bash

sudo apt update
sudo apt install ninja-build

Verify the system ninja location:
Bash

which ninja

(Usually /usr/bin/ninja)

Force VS Code to use the system Ninja: You have two ways to do this. Option A is cleaner, Option B is a "brute force" fix that often persists better through extension updates.

Option A: Edit VS Code Settings

    Open VS Code.

    Press Ctrl + Shift + P and type Preferences: Open User Settings (JSON).

    Look for "idf.customExtraPaths".

    In that string, you will see a path pointing to the bad ninja: /toolkits/espressif/v5.5/tools/tools/ninja/1.12.1/.

    Remove that specific entry from the path string.

    The extension should now fall back to the system ninja (assuming /usr/bin is in your environment path), or you may need to add /usr/bin to this list.

Option B: The "Brute Force" Symlink (Recommended for Stability)

Since the ESP-IDF extension loves to hardcode paths, the most reliable fix is to replace the bad binary file with a link to your system's good binary.

Run these commands in your terminal:
Bash

    # 1. Back up the bad binary (just in case)
    mv /toolkits/espressif/v5.5/tools/tools/ninja/1.12.1/ninja /toolkits/espressif/v5.5/tools/tools/ninja/1.12.1/ninja.bak

    # 2. Create a symbolic link from the system ninja to the ESP-IDF tool folder
    ln -s /usr/bin/ninja /toolkits/espressif/v5.5/tools/tools/ninja/1.12.1/ninja

Why does CLI work but VS Code fails?

    CLI: When you run idf.py build in the terminal, you likely sourced export.sh. This script often checks the environment or might be prioritizing /usr/bin (or a different, correct ninja install) in your $PATH.

    VS Code: The extension relies on idf.customExtraPaths in settings.json. It seems that when the tools were installed (or perhaps the /toolkits folder was copied from an x86 machine), the extension locked onto the x86 version of Ninja and is explicitly trying to run that specific file, ignoring the one in your system path.

Next Step

After applying the "Brute Force" Symlink (Option B), restart VS Code and try to run the build again. It should proceed immediately. Would you like me to help you check if other tools (like cmake or xtensa-esp32-elf-gcc) in that toolkit folder are also x86 binaries?

Build or installation Logs.


Diagnostic report archive.

Note that I probably installed my distro's ninja-build after installing esp-idf. This might be what exposed this issue. After installing my system's inja-build, then replacing /toolkits/espressif/v5.5/tools/tools/ninja/1.12.1/ninja with a symlink to my system's ninja-build, everything worked fine.

More Information.

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions