This is a rough guide on how to set up cross compilation between a BeagleBone BELA and an OSX machine. It is based on the description in the README_BELA file of the SuperCollider installation.
Set date Link to heading
For proper compilation, it is necessary that the BELA board’s time is reasonably similar to your main machine.
dpkg-reconfigure tzdata # configure your time zone
ntpdate pool.ntp.org # sync time once with an ntp server
date # make sure this gives the right result
Since the BBB does not feature a realtime clock that survives reboots, you have to repeat this procedure every time you reboot the board. To prevent that, you might want to set up [[posts/2017-08-06-ntp-on-bela-board|NTP]].
Preparation Link to heading
Since BELA’s SuperCollider compiles on gcc4.8, you need the crosscompiler for arm linux. You can find binaries here. This package installs arm-linux compilers in an exotic directory, which needs to be in your PATH variable:
export PATH=$PATH:/usr/local/linaro/arm-linux-gnueabihf/bin
To prevent mixups of gcc
versions, I created symbolic links of gcc
and g++
to name the specific versions:
cd /usr/local/linaro/arm-linux-gnueabihf/bin/
ln -s arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc-4.8
ln -s arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++-4.8
Install distcc
on both your main machine and the BELA. For OSX, this is easily done with homebrew by
brew install distcc
on the BELA this is done via
apt-get install -t jessie distcc
Compile Link to heading
To ensure proper connection, do not attempt to cross-compile over a wireless connection. It will just not work properly.
On your main machine, run distcc via
distccd --verbose --no-detach --daemon --allow 192.168.7.2 --log-level error --log-file ~/distccd.log
Alternatively, you can set the allowed IP address to the range of your ethernet connection, this could be e.g. 192.168.1.0/22
.
Optionally, you might want to set the log level to info
in order to see some output in the log files, even when the compiler is initiated. I found this very helpful in gaining trust in the system.
Watch the helpfile via
tail ~/distccd.log
On the BELA board, announce the IP to send compile directives to and how the compilers are called
export DISTCC_HOSTS="192.168.7.1"
export CC="/usr/bin/distcc arm-linux-gnueabihf-gcc-4.8"
export CXX="/usr/bin/distcc arm-linux-gnueabihf-g++-4.8"
Make sure you don’t pass -march=native
to the compiler when using distcc, or it will compile natively (for your main machine). So do not pass -DNATIVE=ON
to cmake
.
Building, then, is pretty straight forward:
mkdir build; cd build
# cmake
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
# make will take about 10 minutes, observe the log files on your main machine
make -j8
make install
SC3 plugins setup is similar, only the configuration step is different:
cmake -DSC_PATH="/usr/local/include/SuperCollider/" ..