iii residency – bela cross-compile


17 June 2017

From 10.6.2017 – 24.6.2017 I had the pleasure to be a resident at the instrument inventors initiative (iii) in the Hague. Other posts on the iii residency.


I decided to spend the first week at iii concentrating on software setups. This included updating my Bela-based embedded environment. I was curious on the recent development on the SuperCollider-side there and found out about cross-platform compilation using distcc which massively speeds up the compilation of larger software packages on embedded platforms. Below, I describe the process in more detail, in case someone (me) needs to do this again later-on.

Bela cross compile via distcc

Preparation

As of writing, the cross-compile gcc is available for OSX here. The package installs the arm-linux libs on your host in

/usr/local/linaro/arm-linux-gnueabihf/bin

further, you need to install distcc on both host and board:

# host
brew install distcc

# board
apt-get install distcc

Cross-compile SuperCollider

This guide assumes familiarity with the terminal and cmake-based compilation.

Start the demon distccd on your host:

distccd --verbose --no-detach --daemon --allow 192.168.7.2 --log-level error --log-file ~/distccd.log

Optionally, look at the log-file in a separate terminal

tail -f ~/distccd.log

Since SuperCollider uses cmake and this keeps track of previous configuration runs, make sure to remove CMakeCache.txt in your build directory. If you tried before compiling SuperCollider on the BeagleBone, it might be advisable to start “clean slate” with an empty build directory.

On the board (BBB), you need to first export various variables

export DISTCC_HOSTS="192.168.7.1" 
export CC="/usr/bin/distcc arm-linux-gnueabihf-gcc" 
export CXX="/usr/bin/distcc arm-linux-gnueabihf-g++"

Then, run cmake with the following flags. This implicitly includes distcc set in the previous shell variables.

cmake .. -DNOVA_SIMD=ON -DSSE=OFF -DSSE2=OFF -DINSTALL_HELP=OFF -DSC_QT=OFF -DSC_IDE=OFF -DSC_EL=OFF -DSC_ED=OFF -DSC_VIM=OFF -DSUPERNOVA=OFF -DNO_AVAHI=ON -DENABLE_TESTSUITE=OFF -DAUDIOAPI=bela

Finally, run

make -j8
make install

to build and install SuperCollider. Make sure to glimpse at the log-file every now and then, if there is nothing showing up there while running make, there is something wrong. I found that restarting the demon on the host solves the problem most of the times.

This routine can be easily adapted to compile e.g. the sc3-plugins or FAUST.