Trying to follow instructions from https://blog.monotok.org/compile-locally-run-raspberry-pi-via-clion/ for building executables on my local machine for my raspberry pi.

I have downloaded raspberry pi tools from https://github.com/raspberrypi/tools and am simply trying to run the compiler on my Raspberry Pi Zero W. When I do so, I get the following error:

pi@raspberrypi:~/SoftwareDevelopment/lib/raspberry-pi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin $ ./arm-linux-gnueabihf-gcc
-bash: ./arm-linux-gnueabihf-gcc: cannot execute binary file: Exec format error

I am running raspbian pi.


I ended up using localhost for my remote host in order to do the build using the cross-compiler.

1 Answer 1


The raspberrypi/tools repository contains a cross-compiler. The compiler runs on an x86 computer and generates ARM binaries that can be executed on the Raspberry Pi.

The cross-compiler itself is an x86 binary, it is not meant to be used on the Raspberry Pi itself.
To compile code on the Pi, use the gcc or g++ binaries that are included with RPiOS.

  • That's part of what was confusing me, then. Why does it tell me to add a remote host? Maybe add the local computer as a remote host?
    – Thom
    May 11, 2021 at 8:45
  • @Thom I'm afraid that that's something only the author of the article can answer. When you're running CLion on your computer, from that point of view the RPi is a remote host. I'm not sure what you mean by “adding the local computer as a remote host”.
    – tttapa
    May 11, 2021 at 11:48
  • Evidently, the author is using remote host as a hack to run a different compiler. I used an ssh localhost so it would still build on my local computer. If this is correct, it's even a worse article than I thought.
    – Thom
    May 11, 2021 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.