simspace
Posts: 14
Joined: Wed Jul 11, 2018 10:31 pm

Need help resolving cross compiler error ...

Sun Jul 29, 2018 11:12 pm

I am trying to work through this cross compile tutorial.

I am having one build issue and I can’t find a solution to my problem.

I downloaded the RasPi toolchain, using the link provided in the tutorial, to my laptop running Ubuntu 16.04.

When I try to confirm the (arm-rpi-4.9.3-linux-gnueabihf) compiler works as follows …

Code: Select all

/home/Development/pi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -v
… I get the error “cannot execute binary file: Exec format error.”

When I try to confirm the (gcc-linaro-arm-linux-gnueabihf-raspbian) compiler works as follows …

Code: Select all

/home/Development/pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc -v
… it works fine, no errors.

When I make the wiringPi shared libriary in the tutorial, using the linaro compiler, I get compile errors. So I assume the other compiler is required.

When I work through this other tutorial that uses the linaro compiler, the app builds and it runs on my RasPi Zero too.

I don't understand the difference between the two compilers, and I'm hoping someone can offer ideas or suggestions how I can get this to work?

User avatar
topguy
Posts: 5005
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Need help resolving cross compiler error ...

Mon Jul 30, 2018 3:45 pm

I get the error “cannot execute binary file: Exec format error.”
When I see such an error I automatically think that this compiler is made to run ON the Pi itself, not on an x86/amd64 machine.

You can probably confirm that by using the "file" command on that file. It will tell you a lot about what architecture its for.

Return to “C/C++”