Set Up your B3 as a distcc Client - sakaki-/gentoo-on-b3 GitHub Wiki

Let your B3 invoke remote cross-compilation on your PC, via distcc, and massively speed up the build process!

Prerequisites

This guide assumes that you have already set up your PC as a distcc server as detailed here. So, if you haven't yet, please do this first, before proceeding.

Configuring the B3 as a distcc Client

The live-USB image already has the necessary software (and wrappers) in place for you, so setting up your B3 as a distcc client is easy.

In what follows, I'm going to assume your PC is at the fixed address 192.168.1.116; obviously, adapt the instructions as appropriate.

First, tell distcc where the server is; edit the file /etc/distcc/hosts (on the B3) and append the (uncommented) line:

192.168.1.116/10,cpp,lzo

Note - you can of course set up multiple servers here, but that's beyond the scope of this short guide; see the distcc homepage for further details. Note also that with a slow system like the B3, I would not recommend adding localhost to the hosts list. The B3 will fall back to local compilation where necessary in any event.

Note - the /10 is nothing to do with the IP address (confusingly); it is the maximum number of simultaneous jobs to send to that server (here, 10). The default is 4 if unspecified. Adjust to suit your particular distcc server's capabilities.

Next, edit the file /etc/portage/make.conf (on the B3), and uncomment the following line, thus:

FEATURES="distcc distcc-pump"

That's it! You're now ready to roll.

Using distcc

Now you have everything set up, using distributed cross-compilation from your B3 is really easy. In fact, the (installed) scripts genup and buildkernel-b3 will automatically make use of it - so the next time you update your system, or build a new kernel on the B3, you should notice a significant speed-up.

To use distcc when performing a normal make or emerge, simply prefix the command with pump. So for example:

b3 ~ # pump emerge --ask --verbose www-servers/nginx

That's it!

Monitoring distcc

You can check on distcc's operation at the client end with:

b3 ~ # watch DISTCC_DIR="/var/tmp/portage/.distcc/" distccmon-text

and at the server, most simply, by

gentoo_pc ~ # tail -f /var/log/messages

(or other log viewer, if you are not using syslog-ng).

Troubleshooting

Distributed cross-compilation with distcc/crossdev is neat, but it is not a magic bullet. For example:

  • some parts of the build process (such as autotools ./configure) must still run locally on the B3 (and are considerably time-consuming);
  • some packages (like sys-devel/gcc) rely on running tools that were created during the build, as part of the build; this cannot be distributed with distcc; and
  • languages other than C and C++ are not supported by distcc.

In addition, you will occasionally encounter packages that do not build correctly under distcc (although this is quite rare). You can simply build locally in such cases.

As to other issues, this is only a short guide, and you should read the notes on the distcc site and Gentoo wiki if you experience problems. One important point that is worth mentioning here though - you must ensure that gcc is the same version on your B3 and in your crossdev environment on the PC; bad things are almost guaranteed to happen if not ><

⚠️ **GitHub.com Fallback** ⚠️