I’m running Arch Linux ARM on my Pi and I just had WAY too much trouble getting distcc working.
First, my most idiotic mistake was not having distcc installed on the master (the Pi). I know how that happened. I was going to install and decided to -Syu
first, then forgot.
Secondly, I was trying to get it to work using the makepkg
method, as opposed to the standalone method. What’s the difference? That brings me to…
Thirdly, the guides I was using aren’t great.
What you need to know
If you are trying to cross-compile using distcc on a Raspberry Pi you will almost certainly end up here: https://archlinuxarm.org/wiki/Distcc_Cross-Compiling
Note the warning at the top: “This guide will appear vague and incomplete if you aren’t sure what you’re doing. This is intentional.” That’s rubbish. It’s just very badly written. The only knowledge of “compilation and toolchain components” needed to understand this guide is that the toolchain needs to be installed/built on the client. That’s it.
Once you’ve read the dire warning you are directed here: https://archlinuxarm.org/wiki/Distributed_Compiling
Don’t go there now. The rest of the page is about setting the client up, finish that first.
The biggest problem with this guide is it doesn’t adequately explain just how much of the guide you can skip if you use WarheadsSE’s distccd-alarm package. The fact that WarheadsSE doesn’t explain this in README on his github doesn’t help either. Basically, WarheadsSE’s pkg does everything.
As explained in the guide, WarheadsSE’s pkg builds a toolchain for each ARM architecture and puts them into separate packages. So, build his pkg on your client machine (X86_64 only) and install the pkg for the toolchain you need. For me and my Pi it’s ARMv6l hard.
This package automatically creates the symlinks described in the “Make nice with distcc” section. Further more, it creates it’s own conf file at /etc/conf.d/distccd-armv6h
(obviously depending on your ARM architecture). This contains the correct $PATH variable and is sourced automatically when distcc is run on the master. No need to edit /etc/conf.d/distccd at all. You will have to set the allowed hosts in /etc/conf.d/distccd-armv6h
, though.
Next, read the recommended guide to setting up the master (https://archlinuxarm.org/wiki/Distributed_Compiling). At the bottom you’ll move to configuring the client but the other guide has already taken you through that step. All that remains is to start the systemd service on the client.
Troubleshooting
I tried to troubleshoot using the makepkg
build method. What’s that? Well, it’s the only method explained in the Arch Linux ARM guides. It basically means you use makepkg
to run distcc. This is what you want to do in the long run but the error handling is rubbish. So, instead, go and have a look at this guide: https://wiki.archlinux.org/index.php/Distcc
This guide explains how to run distcc without makepkg
aka “Standalone” method. Short version:
1) add your client IP address to /etc/distcc/hosts
on the master
2) create file on the client called hello_world.cpp and paste this into it:
// 'Hello World!' program
#include <iostream>
int main()
{
std::cout << "Hello World!" << std::endl;
return 0;
}
3) run this distcc g++ -c hello_world.cpp
Now you can see what distcc is trying to do. For me it showed that connection to the client was refused. Obviously (duh) I needed to open a port in my firewall on my client. With that done it just built.
Now you can go back to using makepkg -A
.