Skip to content

Set Up Your crossdev PC for Distributed Compilation with distcc

SabbathHex edited this page Mar 29, 2020 · 4 revisions

Let the RPi3 use your PC's crossdev remotely, via distcc, to speed up its build process!

Prerequisites

This guide assumes that you have already set up crossdev on your PC (and then used it to create an aarch64-unknown-linux-gnu toolchain), per these instructions. So, if you haven't yet, please do this first, before proceeding.

It would also be sensible to try building an RPi4-compatible 64bit kernel, or RPi3-compatible 64bit kernel on your PC beforehand, to make sure that everything really is working correctly.

Making your PC a distcc Server

This is straightforward. First, if you haven't already done so, install distcc on your PC. Issue:

gentoo_pc ~ # emerge --ask --verbose sys-devel/distcc

Next, you need to configure distcc appropriately for your subnet. In the below, I'll assume a 192.168.1.xxx subnet; obviously, alter as appropiate.

So, assuming you are using systemd init on your Gentoo box, edit /etc/systemd/system/distccd.service.d/00gentoo.conf and modify the Service stanza so it reads:

[Service]
Environment="ALLOWED_SERVERS=192.168.1.0/24"

Then issue:

gentoo_pc ~ # systemctl enable distccd
gentoo_pc ~ # systemctl start distccd

to run the service (and ensure it auto-starts at boot).

If you are using OpenRC instead, then edit /etc/conf.d/distccd, and set the following as the only uncommented DISTCCD_OPTS entry:

DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.1.0/24"

Then issue:

gentoo_pc ~ # rc-update add distccd default
gentoo_pc ~ # rc-config start distccd

If you are running a firewall on your PC, ensure it allows TCP connections on port 3632 from your local subnet.

Note that you can also configure distcc to use ssh etc. across a network, but that is beyond the scope of this short guide. See the distcc homepage for more details.

You should now be good to go on the server side of things!

Next Steps

You have the server setup, so next, you just need to configure your RPi3 to use it (the image already has the client software installed, so this is really quick to do). See these instructions for details.

Clone this wiki locally