Cross-toolchain and distcc

From ParabolaWiki
Jump to: navigation, search

1 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.

1.1 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

1.2 Configuring the distcc daemon

1.2.1 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

1.2.2 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/

   Description=A distributed C/C++ compiler for %i targets
   ExecStart=/usr/bin/distccd --no-detach --daemon $DISTCC_ARGS

Now you can start the daemon:

   # systemctl daemon-reload
   # systemctl start distccd@mips64el

1.3 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.

   BUILDENV=(fakeroot distcc color !ccache check) 

Install distcc from repos.

1.4 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: 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.

1.5 References