Setting up Distcc

From Manjaro-Arm
Jump to: navigation, search

Setting up Distcc[edit]

Installation[edit]

Install distcc on all machines you plan to use. The Single Board Computer (SBC) will be the master. In this case it is a raspberry Pi 2. All other devices should be set up as clients.

Creating Jobs[edit]

On the master, edit /etc/makepkg.conf to enable distcc. Specify the IPs of all devices. Set number of make jobs using the -jXX flag, where XX would be the total number of CPU cores across all clients and the master. If I am using a quad-core desktop with my raspberry pi 2 it would be -j8. If the quadcore CPU supports multi- or hyperthreading, you can count each core as two - so -j12. Example of important lines to change in /etc/makepkg.conf:

 #unnegate the distcc option (remove the ! infront)           
 BUILDENV=(distcc color !ccache check !sign)
     
 #Just add the IP of each client seperated with a space. Can probably use subnet range 192.168.1.0/24
 DISTCC_HOSTS="192.168.1.95 192.168.1.98"
 #Set job flag according to above info
 MAKEFLAGS="-jXX"

Installing the CC toolchain[edit]

On the clients, install the Gnu Cross Compiling toolchain (or gcc). Until one is built, you can use archlinux-arm's prebuilt ones.

Configuring /etc/conf.d/distccd[edit]

Configure /etc/conf.d/distccd to allow the IP of the master device and to add the toolchain bin directory to the $PATH. Example:

 # Parameters to be passed to distccd
 # You must explicitly add IPs (or subnets) that are allowed to connect,
 # using the --allow switch.  See the distccd manpage for more info.
     
 #This line will be custom to where your toolchain's bin directory is
 PATH=/home/dodgejcr/x-tools-arm7/x-tools/arm-unknown-linux-gnueabihf/bin:$PATH
 #If the Master device is at 192.168.1.100, you can also use subnet range: 192.168.1.0/24      
 DISTCC_ARGS="--user nobody --allow 192.168.1.100"

Enable and Start distccd[edit]

 # systemctl enable distccd && systemctl start distccd