Skip to content

Set Up Your crossdev PC for Distributed Compilation with distcc

sakaki edited this page Mar 5, 2016 · 3 revisions

Let the B2 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 and the gentoo-b2 overlay on your PC, per these instructions. So, if you haven't yet, please do this first, before proceeding.

It would also be sensible to try building a B2-compatible 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 append the following line:

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 B2 to use it (the image already has the client software installed, so this is really quick to do). See these instructions for details.