Raspberry Pi/Cross building

Building almost any software on embedded SoC computers such as the Raspberry Pi can take a very, very long time - especially when many dependencies are involved. Fortunately, it is possible to Article description::offload much of the heavy lifting for compilation to a more powerful build system (such as a Gentoo desktop/server with more compute cores and more memory) using and. This time saving tactic is only possible for packages that are written in language that require compiling (such as C, C++, etc.).

distcc
It is also suggested that the first package you build on the Raspberry Pi should be distcc, as it will dramatically speed up subsequent packages that require a lot of compilation.

Raspberry Pi and build server(s)
On the Raspberry Pi and on all build servers install :

OpenRC
Edit the distcc config file to ensure it is on the right subnet for the network configuration. For example:

Systemd
When using systemd edit the config file for the systemd service:

Then register and start the distcc daemon:

Or for systemd:

Raspberry Pi only
Tell Portage to use distcc:

(Optional) Also add  to the FEATURES variable to tell the Raspberry Pi to build package files for everything it builds (if you want to use the same setup on multiple Raspberry Pis without recompiling).

Edit the distcc host file to tell your Raspberry Pi to submit compile jobs to the server:

Now you will need to tell distcc the specific compiler name to use instead of just "gcc":

We need to replace those symlinks with the following script:

Double check that you did things right:

You can now check what is being dispatched to your build machines while doing an emerge operation:

crossdev
This will setup crossdev on your build servers so that they can compile binaries compatible with the Raspberry Pi. Note that you can have multiple compilation nodes - just add them to the list of hosts on the Raspberry Pi. Distcc will decide when to distribute the compilation though, so chances are you will never be able to fully load even a single modern build server with jobs from the Raspberry Pi.

Install :

You will need to maintain separate portage profiles for the Raspberry Pi and your server's default, so you must convert your existing profile files to folders.

Copy the following file to, and then run it as root:

Create a cross toolchain for ARM: (drop the  option from the command when planning to run an unstable system):

If the cross toolchain for ARM fail to build try this: