Raspberry Pi/Cross building

Building almost anything on the Raspberry Pi takes a very, very long time - especially when there are a lot of dependencies involved.

Fortunately, you can offload much of the heavy lifting work to a more powerful system (such as your main Gentoo desktop/server) using distcc and crossdev (though this will only work for packages must compile C/C++).

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 servers
On the Raspberry Pi and on all build servers install :

Edit the distcc config file to ensure it is on the right subnet for your network configuration, for example:

Then register and start the distcc daemon:

Raspberry Pi only
Tell portage to use distcc:

(Optional) Also add to FEATURES "buildpkg" 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 your 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 with this script:

Or simpler with:

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 -S if you plan to run an unstable system):

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