While the Raspberry Pi 2 has four cores to churn through code, it still takes longer to compile than on most workstations and laptops. If you are feeling adventurous, you can try cross-compiling which has become easier to set up and get working.
Cross-compiling is when binaries created are for another target architecture than the one you are compiling on. This kind of set up is very typical when creating Android applications. The end result is that you can take the resulting binary and place on its target platform, and it will run there.
There are even tricks to getting the cross-compiled binary to also run on your native system!
In this guide, I’ll walk you through:
- Setting up a cross-compile toolchain in Ubuntu (15.04 Vivid)
- Setting up the proper exports
- Compiling a test program for your native and target armhf platform
- Compiling the latest Raspberry Pi 2 kernel with VC4 support.