Friday, November 1, 2013

Raspberry Pi X-Compilation using distcc

I just successfully used distcc for cross compilation for the first time on my Raspberry Pi. I am using Arch Linux both on my Pi and my desktop. You can get distcc from the official Arch repos.
Setting up distcc is not hard:
You need to edit the following files (as root):

  • /etc/conf.d/distcdd (both server(s) and daemon):
    • add allowed ip addresses to DISTCC_ARGS with --allow <addr>
  • /etc/makepkg.conf (daemon only):
    • in BUILDENV: change !distcc to distcc
    • uncomment DISTCC_HOSTS and add hosts using the format <addr>/<number of threads>
    • edit MAKEFLAGS to use the desired number of threads, e.g. MAKEFLAGS="-j3"
    • if neccessary specifiy a PATH variable
  • /etc/distcc/hosts (daemon only):
    • add the hosts here (this seems redundant, but it was neccessary for me)
In order to use distcc you will need proper compilers on your hosts. For the Pi you can build your own toolchain or just download one if it's available for your platform.
Test your compiler with a small program like this (c++):

distcc c++ hello.cxx -o hello

Instructions and a cross compilation toolchain for Arch can be found here:

No comments:

Post a Comment