arduino / arduino-cli

Arduino command line tool
https://arduino.github.io/arduino-cli/latest/
GNU General Public License v3.0
4.33k stars 375 forks source link

Compilation Error avr-g++ no such file or directory #2534

Closed Aterox-os closed 7 months ago

Aterox-os commented 7 months ago

Describe the problem

Hello, I know that this error was reported multiple times but none of the solutions of the other posts worked for me. I am getting the following error: Error during build: fork/exec /root/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++: no such file or directory

I tried to install it on a Raspberry Pi with a fresh Debian lite installation.

To reproduce

I followed the official guide and this nonofficial guide. None of them worked. https://www.caronteconsulting.com/en/news/how-to/raspberry-arduino-cli/

Expected behavior

Compile my code

Arduino CLI version

0.35.2

Operating system

Linux

Operating system version

Raspbian / Linux 12

Additional context

No response

Issue checklist

matthijskooijman commented 7 months ago

Does the file /root/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ exist and is it executable?

What does ldd /root/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ output?

I suspect that maybe the file exists, but has the wrong architecture, so the "no such file" might refer to the dynamic loader being missing, not the avr-g++ file itself.

Aterox-os commented 7 months ago

Sorry for the late response. I get not a dynamic executable.

matthijskooijman commented 7 months ago

I get not a dynamic executable.

Hm, I just tested running ldd on a raspberry pi on an x86_64 executable and I get the same, so maybe your av-g++ binary also has the wrong architecture.

IIUC, arduino-cli autodetects your architecture (or maybe has it hardcoded based on for which architecture the arduino-cli binary is built), and based on that downloads the right compiler tarball. It looks a bit like it might have downloaded the wrong one (but that's just a theory so far). I'm not quite sure how to get arduino-cli to print the arch it thinks you are on, though.

Some more commands to figure out more:

file  /root/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++
file $(which arduino-cli)
ls ~/.arduino15/staging/packages/