Raspberry Pi/Cross building

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 crossdev and distcc (though this will only work for packages must compile c/c++).

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.

distcc
On all distcc build servers and on the Raspberry Pi, you will need to 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:

On the Raspberry Pi
Tell portage to use distcc:

(Optional) Also add to FEATURE "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 beefy server(s) so that it 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 ~/convert-profile-to-files.sh, 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: