Arduino-cli fails to compile a sketch for Teensy4.1 error: arm-none-eabi-g++ no such file or directory

I am trying to upload a sketch to a Teensy 4.1 on a raspberry pi running raspbian bullseye using arduino-cli, however it throws an error:

Command:
arduino-cli compile HardwareTest.ino --output-dir Build/ --fqbn teensy:avr:teensy41 -v

Error:

FQBN: teensy:avr:teensy41
Using board 'teensy41' from platform in folder: /home/pi/.arduino15/packages/teensy/hardware/avr/1.59.0
Using core 'teensy4' from platform in folder: /home/pi/.arduino15/packages/teensy/hardware/avr/1.59.0


Detecting libraries used...
/home/pi/.arduino15/packages/teensy/tools/teensy-compile/11.3.1/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++17 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=159 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/pi/.arduino15/packages/teensy/hardware/avr/1.59.0/cores/teensy4 /tmp/arduino/sketches/92B0F0E14D32A709C62320DED291AF39/sketch/HardwareTest.ino.cpp -o /dev/null


Used platform Version Path
teensy:avr    1.59.0  /home/pi/.arduino15/packages/teensy/hardware/avr/1.59.0
Error during build: fork/exec /home/pi/.arduino15/packages/teensy/tools/teensy-compile/11.3.1/arm/bin/arm-none-eabi-g++: no such file or directory

The same error was thrown by arduino-ide (version 1.8.x as those are the only ones available for raspbian), it was solved by uninstalling and reinstalling the board using the board manager, suggested by the solution to this post on the arduino forum:

Inspired by that post, I tried reinstalling the teensy board using arduino-cli like so (yes, the board url has been placed in ~/.arduino15/arduino-cli.yaml):
I first ran:
arduino-cli core uninstall teensy:avr
Then:
arduino-cli core install teensy:avr

However, that did not work. The compilation command still throws the same error.

Any ideas on how I can fix this?

Thanks!

Works fine for me on bullseye 32 bit.

me@pi:~/Documents/sketchbook/Teensy41/test $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
me@pi:~/Documents/sketchbook/Teensy41/test $ uname -m
armv7l
me@pi:~/Documents/sketchbook/Teensy41/test $ board="teensy41";arduino-cli compile -v -b teensy:avr:$board:usb=serial,speed=600,opt=o1std,keys=en-us --warnings all --output-dir ~/tmp --no-color

FQBN: teensy:avr:teensy41:opt=o1std
Using board 'teensy41' from platform in folder: /home/me/.arduino15/packages/teensy/hardware/avr/1.57.2
Using core 'teensy4' from platform in folder: /home/me/.arduino15/packages/teensy/hardware/avr/1.57.2

Detecting libraries used...
/home/me/.arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/me/.arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/sketch/test.ino.cpp -o /dev/null
Generating function prototypes...
/home/me/.arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/me/.arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/sketch/test.ino.cpp -o /tmp/2561436180/sketch_merged.cpp
/home/me/.arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/2561436180/sketch_merged.cpp
Compiling sketch...
/home/me/.arduino15/packages/teensy/tools/teensy-tools/1.57.2/precompile_helper /home/me/.arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5 /home/me/.arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-g++ -x c++-header -O1 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/me/.arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/pch/Arduino.h -o /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/pch/Arduino.h.gch
Using previously compiled file: /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/pch/Arduino.h.gch
/home/me/.arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-g++ -c -O1 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/pch -I/home/me/.arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/sketch/test.ino.cpp -o /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/sketch/test.ino.cpp.o
Compiling libraries...
Compiling core...
Using precompiled core: /tmp/arduino/cores/teensy_avr_teensy41_usb_serial,speed_600,opt_o1std,keys_en-us_f00d0646e00e19b231c2edb28d78d422/core.a
Linking everything together...
/home/me/.arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-gcc -O1 -Wl,--gc-sections,--relax -T/home/me/.arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4/imxrt1062_t41.ld -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -o /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/test.ino.elf /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/sketch/test.ino.cpp.o /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/../../cores/teensy_avr_teensy41_usb_serial,speed_600,opt_o1std,keys_en-us_f00d0646e00e19b231c2edb28d78d422/core.a -L/tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5 -larm_cortexM7lfsp_math -lm -lstdc++
/home/me/.arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/test.ino.elf /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/test.ino.eep
/home/me/.arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-objcopy -O ihex -R .eeprom /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/test.ino.elf /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/test.ino.hex
/home/me/.arduino15/packages/teensy/tools/teensy-tools/1.57.2/teensy_secure encrypthex TEENSY41 /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/test.ino.hex
No key .pem file found, skipping .ehex encryption
/home/me/.arduino15/packages/teensy/tools/teensy-tools/1.57.2/teensy_post_compile -file=test.ino -path=/tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5 -tools=/home/me/.arduino15/packages/teensy/tools/teensy-tools/1.57.2/ -board=TEENSY41
/home/me/.arduino15/packages/teensy/tools/teensy-tools/1.57.2/stdout_redirect /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/test.ino.sym /home/me/.arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-objdump -t -C /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/test.ino.elf
Memory Usage on Teensy 4.1:
  FLASH: code:8772, data:3992, headers:8736   free for files:8104964
   RAM1: variables:4512, code:6224, padding:26544   free for local variables:487008
   RAM2: variables:12384  free for malloc/new:511904
/home/me/.arduino15/packages/teensy/tools/teensy-tools/1.57.2/teensy_size /tmp/arduino/sketches/BCB2B1FDE28D8C079B6B21288EC09CD5/test.ino.elf

/home/me/.arduino15/packages/teensy/tools/teensy-tools/1.57.2/teensy_secure encrypthex TEENSY41 /home/me/Documents/sketchbook/Teensy41/test/test.ino.TEENSY41.hex
No key .pem file found, skipping .ehex encryption

Used platform Version Path
teensy:avr    1.57.2  /home/me/.arduino15/packages/teensy/hardware/avr/1.57.2

me@pi:~/Documents/sketchbook/Teensy41/test $ 

Hi @shookti. What do you see printed in the terminal if you run this command from the command line:

ls /home/pi/.arduino15/packages/teensy/tools/teensy-compile

Hi @ptillisch , this is the output:

pi@raspberrypi:~ $ ls /home/pi/.arduino15/packages/teensy/tools/teensy-compile/
11.3.1  5.4.1

For completeness:

pi@raspberrypi:~ $ ls /home/pi/.arduino15/packages/teensy/tools/teensy-compile/
11.3.1  5.4.1
pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ ls /home/pi/.arduino15/packages/teensy/tools/teensy-compile/11.3.1/
arm  avr
pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ ls /home/pi/.arduino15/packages/teensy/tools/teensy-compile/5.4.1/
pi@raspberrypi:~ $

@van_der_decken , I haven't faced any such problems with arduino-cli until now, it works perfectly well on other RPIs.

@ptillisch
The file that the error says does not exist does in fact exist:

pi@raspberrypi:~ $ ls /home/pi/.arduino15/packages/teensy/tools/teensy-compile/11.3.1/arm/bin/arm-none-eabi-g++ 
/home/pi/.arduino15/packages/teensy/tools/teensy-compile/11.3.1/arm/bin/arm-none-eabi-g++
pi@raspberrypi:~ $

what happens if you try to execute it?
Something like:
pi@raspberrypi:~ $ /home/pi/.arduino15/packages/teensy/tools/teensy-compile/11.3.1/arm/bin/arm-none-eabi-g++ --help

Does it run?

Looks like more stuff up on Teensy forum:
arduino-cli does not compile sketch for Teensy4.1 | Teensy Forum (pjrc.com)