Cross-toolchain and distcc - ParabolaWiki

# Cross-toolchain and distcc

# Use a cross toolchain and distcc for the MIPS64el port

You can build packages natively for the mips64el architecture on your Lemote Yeeloong, but sometimes it can be time consuming (libwebkit, for instance, takes up to 24hs. to build). If you have at least one computer in your network with a faster processor, you can configure it as a distcc daemon for your Yeeloong. This will build packages natively and also at fast speed.

You'll need two things on each distcc daemon machine: a cross-toolchain and a distcc daemon running and configured correctly.

## Getting the cross-toolchain

You can download our i686-pc-linux-gnu to mips64el-unknown-linux-gnu toolchain and unpack it under the host system root (/). The toolchain files are located on /usr/mips64el-unknown-linux-gnu.

This cross-toolchain has been generated using crosstool-ng.

Note: What follows is information in case you want to do this manually, the steps described above should suffice. Skip to #Configure distccd-mips64el

## Configuring the distcc daemon

### Fix the PATH

Since this particular distcc daemon will be used for cross compilations, we'll have to trick the native distcc to find the cross-toolchain binaries other than in the usual /usr/bin dir

       # cp /etc/conf.d/distcc{,-mips64el} # <= we rename it so we can still run natively
       # echo "PATH=/usr/mips64el-unknown-linux-gnu/bin" >>/etc/conf.d/distcc-mips64el

### Configure distccd-mips64el

Edit /etc/conf.d/distccd-mips64el and change the --allow flag to allow connections from every machine on your network/subnet, or just a specific IP address. Save and quit.

Note: If you have a firewall that drops connections for unespecified ports, open the port 3632 for both tcp and udp.

Create /etc/systemd/system/multi-user.target.wants/distccd@mips64el.service:

       [Unit]
       Description=A distributed C/C++ compiler for %i targets
       Documentation=man:distccd(1)
       After=network.target

       [Service]
       User=nobody
       EnvironmentFile=/etc/conf.d/distccd-%i
       ExecStart=/usr/bin/distccd --no-detach --daemon $DISTCC_ARGS

       [Install]
       WantedBy=multi-user.target

Now you can start the daemon:

       # systemctl daemon-reload
       # systemctl start distccd@mips64el

## Configure the Yeeloong

Edit your makepkg.conf to enable the distcc option, by removing the bang prefix. Also set your MAKEFLAGS to the amount of processors used plus one. For instance, to build on the Yeeloong and another single core computer, use -j3.

       MAKEFLAGS="-jX"
       BUILDENV=(fakeroot distcc color !ccache check)

Install distcc from repos.

## Build!

Get a PKGBUILD and run makepkg -flags on it. If you don't see any error message from distcc after the configure script is ran, and if you see a lot of messages like this:

       May 28 04:15:08 localhost distccd[29238]: (dcc_job_summary) client: 10.0.0.3:36060 COMPILE_OK exit:0 sig:0 core:0 ret:0 time:237ms gcc spawnattr_getschedparam.c

on `journalctl -f`, and if the build ends correctly and you get MIPS-III N32 binaries, you're set, congrats!

Note: To get the info about binaries, simply run file over them.

## References

- Distributed compiling with distcc at plugapps.com (home of the Archlinux ARM port).

Category:

- MIPS