I'm trying to cross-compile from my Ubuntu 14.04 (host) to the pi zero. Here is what I've done on host to cross compile a very basic example :

> apt-get install g++-arm-linux-gnueabihf from here

Then created a simple test.cpp :

#include <iostream>

int main() {
    std::cout << "hello world" << std::endl;
    return 0;


> arm-linux-gnueabihf-g++ -marm -mtune=arm1176jzf-s -march=armv6 test.cpp

Finally copy and paste the exec on my pi zero, execute it, and get a SEGFAULT error... No way to get more, even with gdb option.

I guess this comes from a bad cross compiler option, the exec seems to be not readable from the broadcom 2835 . But I've tried all cross-compiler options (arm-linux-gnueabihf-g++ -v) that could arrange that without successing...

Anyone has already done some cross compilation to the pi zero and could help ?

Thanks a lot

1 Answer 1


the exec seems to be not readable from the broadcom 2835

Yes, and really the compiler should reject these options:

-mtune=arm1176jzf-s -march=armv6

Because it can't do that properly. ARM cross compiler packages for various mainstream linux distros are, as far as I am aware, all ARMv7+.

Something that gets confusing here is the "hard float" bit. This can distinguish arm1176jzf from earlier ARMv6 implementations; it's the last version of it. After that you have ARMv7, which I believe by definition is hard float, and so that is how Debian chooses to identify it. Note that page is linked from the SUNXI wiki page you posted, and includes further qualifications:

Currently the Debian armhf port requires at least an ARMv7 CPU with Thumb-2 and VFP3D16.

That's what their cross compiler is made to target. Ubuntu follows the same pattern. It won't work to cross compile for model 1 (single core) pis, with the BCM2835 SoC.

The confusing bit is that this means Debian's armhf tag is not the same as the armhf tag as used by Raspbian, which is the arm1176jzf implementation of ARMv6.

What you want is here.

  • Thanks for your quick answer, I was about to test this tool :) Hope it will work ! I let you know Thanks again
    – etiennedm
    Dec 15, 2016 at 14:07

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.