Enabling Distributed Cross-Compiling for PixieBoard

Jose Ruiz
PixieBoard
Published in
3 min readAug 10, 2018

--

We always say that our platform is designed for power users. And power users create powerful software. The downside to this is that sometimes compilation can take a long time. That’s the reason I’m writing today how you can setup a Cross-compilation distributed environment in just a few minutes.

Arch Linux ARM provides the tools necessary for this distributed toolchain.

What you’ll need

The Big Machine

The idea behind setting a distributed cross compiling environment is to take advantage of a bigger/faster processor (of different architecture) to help during the compilation process. In this setup, files are shared between the master (your PixieBoard) and a slave host (your big machine) using your local LAN or WLAN. We assume your PixieBoard and your server/workstation/laptop are able to communicate with each other, so make sure they can access the same segment of your network and that there is no firewall or other network settings prevented this from happening.

For this, I’ve prepared a Virtual Machine that’s already configured. You can download it here. You will also need to install the latest version of Oracle’s Virtual Box.

Setup the (slave) Virtual Machine

Unzip the files you downloaded in the previous step and open Virtual Box. From the toolbar at the top select “New”. This will open a new window, make sure to select the correct options, including:

  • A name for your VM (that starts with “Arch”, preferably).
  • Type: Linux.
  • Version: Arch Linux (64-bit). (Or 32-bit if that’s your host’s architecture).
  • Memory size: 2048.
  • Hard disk: Use an existing virtual hard disk file. Select the extracted .vdi file.
Load the pre-configured VM.

Now, go to settings and navigate to the network tab. In the “Attached to” option select “Bridged Adapter”. Make sure the correct interface name is selected bellow.

Change the network settings to Bridged Adapter.

Hit Create. Then Start.

The new machine will open in a new window. The login credentials for your slave host are:

  • Username: archuser
  • Password: archuser

Open a terminal and take note of the assigned IP:

ip addr show
Take note of your VM’s IP address.

Remember, this IP address must be accessible by your PixieBoard.

That’s it for now. The necessary daemons are already running and configured. This VM is also accessible through ssh with the same credentials and it’s running avahi so you can access it with the hostname archdistcc.local.

Your (master) PixieBoard

If you are reading this article I assume you already have a working setup with PixieBoard and it’s running Arch. If this is not the case, please follow this guide first.

I also recommend you take a look at our publication: Medium — PixieBoard. We are always posting cool guides and content, so follow us and add it to your bookmarks :).

Now, back to where we were. Make sure your toolchain is installed and up to date in your PixieBoard:

sudo pacman -Sy base-devel python

Also, install distcc:

sudo pacman -S distcc

Start compiling

Using makepkg

We need to tell makepkg to use distcc, so open the configuration file (/etc/makepkg.conf) and change the following lines, making sure you uncomment them first (writing the correct IP for your VM):

MAKEFLAGS="-j32"BUILDENV=(distcc fakeroot color !ccache check !sign)DISTCC_HOSTS="YOUR.VM.IP.ADDR"

Choose the number of jobs in the “-jJOBS” option according to your host resources.

That’s it, next time you compile a package, the job will be distributed to your slave VM.

--

--

Jose Ruiz
PixieBoard

Also know as Chepe. Has a passion for technology, mathematics and motorcycles. And guitars.