Compiling for Teensy on ARM fails

I’m trying to compile a Teensy 3.6 project (Arduino framework) with platformio on an ARM platform running Ubuntu.
It’s a Nvidia Jetson TX2 (Armv8-A). It can’t find cc1plus when compiling.

Processing teensy36 (platform: teensy; board: teensy36; framework: arduino)
arm-none-eabi-g++ -o "/home/willem/catkin_ws/src/jros_robot/micro/basemc/src/basemc.ino.cpp" -x c++ -fpreprocessed -dD -E "/tmp/tmpvNTUGF"
arm-none-eabi-g++: error trying to exec 'cc1plus': execvp: No such file or directory
*** Error 1

Any help appreciated.

Does it work with Teensyduino?

I’ve tried to use Teensyduino, I didn’t get it to work but I did learn more about the problem.
To use Teensyduino I need the Arduino software which I didn’t get to work (because of a Java issue I think).

So I did some further digging and I think I know the cause of the problem. The PlatformIO toolchain (toolchain-gccarmnoneeabi) seems to be 32 bit while my platform is 64 bit ARM.

When I try to just run the compiler I get the message that the file cannot be found, which happens if you try to run an 32 bit binary on a 64 bit system:

$ ~/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++
-bash: /home/willem/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++: No such file or directory

$ file ~/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++
/home/willem/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/, for GNU/Linux 2.6.32, BuildID[sha1]=3fe0d6010e87afa9fefb1b148f647a1a6f066eb7, stripped

$ uname -i

So to solve this an ARM 64 bit PlatformIO toolchain-gccarmnoneeabi which produces 32 bit binaries for the Teensy would be needed right? How can this be solved?

(note: I also tried with remote agent so that compile is not done on the ARM system, this however fails because of the same reason. pioplus can’t be executed because it is a 32 bit executable)

Could you try Teensyduino: Download and Install Teensy support into the Arduino IDE ? You will see toolchain after unpacking.

@ivankravets thanks for your quick response. I assume you refer to the Linux Installer (ARM / Raspberry Pi) on that page.
The download (TeensyduinoInstall.linuxarm) seems to be a self-extracting executable. Unfortunately this is also a 32 bit executable so it can’t be used on a 64bit ARM Ubuntu.

$ file TeensyduinoInstall.linuxarm 
TeensyduinoInstall.linuxarm: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), statically linked, stripped

Apparently the system provided 64bit tools can create 32bot binaries for the Teensy.
What I did was from the PlatformIO toolchain remove the binaries, ie:

rm -rf ~/.platformio/packages/toolchain-gccarmnoneeabi/bin
rm -rf ~/.platformio/packages/toolchain-gccarmnoneeabi/lib

This would cause the system installed compiler chain to be used. Then there was a library missing:

/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: cannot find -larm_cortexM4lf_math

which I fixed by:

export PLATFORMIO_BUILD_FLAGS=-L/home/willem/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/lib/

Then I can compile and upload to the Teensy. It would be nice this could be done without hacking the platform toolchain of course. Also in the future I would prefer to be able to use the remote agent.

@ivankravets In follow up of above, are there any plans for 64 bit ARM support of the remote agent?

Could you provide an output from terminal?

python -c "import platform; print [platform.system(), platform.machine(), platform.architecture()]"

I have the same setup and here is the answer to your question
[‘Linux’, ‘aarch64’, (‘64bit’, ‘ELF’)]

I am seeing everything robobit mentioned and the reasoning makes sense to me from a similar path.

Thanks for this. I’m not working on the hardware anymore (might be in the future) so I wasn’t able to generate the output.

Thanks! I opened a feature request for this