How do I cross-compile my application for Ubuntu 12.04 armhf architecture on a Ubuntu 12.04 i386 host?

Solution 1:

https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/UsingMultiArch

https://wiki.ubuntu.com/MultiarchCross

Ubuntu has a cross-toolchain, apt-get install gcc-arm-linux-gnueabihf but work on the next-gen toolchain is discussed here: http://gsoc.sitedethib.com/posts/apt-get_install_gcc-4.7-arm-linux-gnueabihf/

There are a number of workarounds that are necessary at this point. For example, if you use indirect linking (covered in the linaro wiki page.) You also should avoid running foreign binaries right after compiling them.

Also, its really most mature with autotools.

I got my package to cross-compile fairly quick.

apt-get build-dep -aarmhf foo-pkg
apt-get source foo-pkg
cd foo-pkg-*
dpkg-buildpackage -aarmhf