Building JackTrip for Elk Audio OS

I believe there are many attractive things about Elk Audio OS. It is optimized for audio applications by experts, runs a customized 64-bit kernel on Raspberry Pi, has a great toolchain for customization, and has a slick update mechanism that uses two rotating partitions to ensure it can always boot successfully.

I wanted to try out JackTrip on Elk Audio OS (“Elk”) and compare it to my previous test results. Unfortunately, the HiFiBerry kernel support only works with Elk’s tools and libraries. Although Jack is included on Elk, there is no ALSA driver available for the HiFiBerry boards, and so you are unable to use Jack (or JackTrip) with them.

I learned too late that I would come to this dead end. But I was able to get JackTrip built and working for USB devices on Elk. The process was a bit tricky, so I decided to document it for posterity, in case someone else may benefit from this, or an ALSA driver becomes available one day.

Normally, I would build software using the development toolchain provided on a Raspberry Pi. Elk Audio OS uses small partitions, which are not easy to resize, so you quickly run out of space trying to build anything large. Luckily, they provide a solid cross-compilation toolchain based on the Yocto Project. I used this with the Crops container image, but you can also just install the SDK without the container if you prefer.

mkdir ~/crops
cd ~/crops
wget https://github.com/elk-audio/elkpi-sdk/releases/download/0.7.2/elk-glibc-x86_64-elkpi-audio-os-image-aarch64-raspberrypi4-64-toolchain-1.0.sh
chmod a+x elk-glibc-x86_64-elkpi-audio-os-image-aarch64-raspberrypi4-64-toolchain-1.0.sh
docker run --rm -it -v /home/users/mdickey/crops:/workdir crops/extsdk-container --url file:///workdir/elk-glibc-x86_64-elkpi-audio-os-image-aarch64-raspberrypi4-64-toolchain-1.0.sh

JackTrip uses the Qt framework, and since this is not included in Elk, you have to build it yourself. Unfortunately, building Qt requires Perl, and the version included in Elk is missing many of the necessary modules. So the first step is building a local version of Perl:

wget https://www.cpan.org/src/5.0/perl-5.30.2.tar.gz
tar -xzf perl-5.30.2.tar.gz
cd perl-5.30.2
./Configure -des -Dprefix=/workdir/localperl
make -j4
make install
export PATH=/workdir/localperl/bin:/workdir/qtbase/bin:$PATH

Now that you have a working version of Perl, you are ready to build Qt:

git clone git://code.qt.io/qt/qt5.git
cd qt5
git checkout 5.14.2
perl init-repository
cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/aarch64-elk-linux-gcc
sed -i'' "s,arm-linux-gnueabi-gcc,$CC,g" qtbase/mkspecs/aarch64-elk-linux-gcc/qmake.conf
sed -i'' "s,arm-linux-gnueabi-g++,$CXX,g" qtbase/mkspecs/aarch64-elk-linux-gcc/qmake.conf
sed -i'' "s,arm-linux-gnueabi-,,g" qtbase/mkspecs/aarch64-elk-linux-gcc/qmake.conf
./configure -prefix /workdir/qtbase -confirm-license -opensource -nomake tests -nomake examples -no-gui -no-widgets -xplatform aarch64-elk-linux-gcc
make -j4
make install

Finally, you should be able to build JackTrip:

git clone https://github.com/jacktrip/jacktrip.git
cd jacktrip/src
qmake QMAKE_CXX="$CXX" QMAKE_LINK="$CXX" INCLUDEPATH="/workdir/qtbase/include" LIBS="-L/workdir/qtbase/lib" -spec linux-g++ jacktrip.pro
make -j4

Note that the JackTrip binary links with the libQt5Network.so.5 and libQtCore.so.5 dynamic libraries, so you’ll need to include them in your search path to run it.

Just want the final results? Here they are:

Leave a Reply