Building Mixxx 2.2 for Raspberry Pi Zero

A few weeks ago I successfully managed to build Mixxx 2.x on a Raspberry Pi 3. Once I got that done I immediately identified “more than enough” (that is: one) situations where it would be great to have yet a smaller piece of hardware to run Mixxx on (placing a link. Just in case you might not already know what we’re talking about). That’s why I think running Mixxx on a Raspberry PI Zero ist the next logical consequence.

I once (and only once) managed to successfully build the latest branch on a Pi Zero (2.3.0 alpha pre, as of time of this writing) but was not able to reproduce it. Good thing: After some tedious trial-and-error I finally found a way to reliably build Mixxx 2.2 for (and on!) a Raspberry Pi Zero.

Some words up front: Running Mixxx on a Pi Zero is slooooooow. It takes ages to start and consumes ridiculous amounts of CPU cycles in operation and probably isn’t a pleasing experience in general. You DO have to take care about heat dissipation because running on ~90% CPU for a longer time just makes the little device emit an ammount of heat that will become problematic sooner or later. However, there are some usecases where it might be a sensible alternative. We’ll come to that later.

Of course, in order to build Mixxx at all you have to take all steps as described in the other post “sudo apt-get install” all that stuff. 

Since we’re talking Mixxx 2.2 here our command-line for pulling from the git repo needs to be

git clone -b 2.2 https://github.com/mixxxdj/mixxx.git

Second: Optimization is key. In the previous post the commandline for building Mixxx on a RPI 3 was:

sudo scons -c && sudo scons -j 3 opengles=1 staticlibs=1 optimize=native

As you may have guessed, this creates an executable which is optimized for the RPI hardware platform. My first idea was to build Mixxx executable on a RPI 3, take the SD card out of the device, put it in a PI Zero and boot it. Upon starting the “Pi3”-Mixxx on a Pi Zero I was greeted with

“Invalid Instructions”

“Ungültiger Maschinenbefehl”

This is kind of comprehensible: The Raspberry Pi 3+ and Zero are built around different hardware.  (Broadcom BCM2837B0 instead of BCM2835). Optimizing it for one platform will probably cause ‘something’ on the other one. That’s what we’re seeing here (at least that’s what I think). One workaround is to simply turn off optimization:

sudo scons -c && sudo scons -j 1 opengles=1 staticlibs=0 optimize=off

This works. Turning off optimization enables you to build Mixxx 2.2 on a Raspberry Pi 3 and run it on a Pi Zero. It will take ~1 hour to build Mixxx 2.2 on a Raspberry Pi 3. Great. We got a working binary now.

Since we are on a somewhat tight CPU budget (and since we’re in it for the fun of senselessly compiling stuff) the next step is to compile Mixxx 2.2 actually ON a Raspberry Pi Zero. This is possible as long as you get your memory settings correct. Remember that the Pi Zero only has some meager 512MB of Ram. So: set the Pi Zero’s memory split to 256 MB.

Next: expand the swap file. If you ommit this step the build process will exit on various occasions with errors like this:

Error: open CFI at the end of file; missing .cfi_endproc directive

Setting the swap-file’s size is simply done by editing the file /etc/dphys-swapfile . Find the line that says

CONF_SWAPSIZE=100

and change it to

CONF_SWAPSIZE=1024

Do a reboot and afterwards you are good to go and compile Mixxx on the Raspberry Pi Zero. Be sure to NOT optimize it.

Mixxx 2.2 will only compile on a Raspberry Pi Zero if you build it with this command line:

sudo scons -c && sudo scons -j 3 opengles=1 staticlibs=1 optimize=off

The important bit is optimize=off.

If you did everything right you will be presented with a shiny new version of Mixxx after approximately 16 hours. That’s right. Building Mixxx on a Raspberry Pi Zero will take about 16 hours. Better be sure to have everything set up correctly beforehand – or end up like me … running back and forth between your computers for 10 days in a row.

Why would anyone do that?

All this effort might be “sensible” in areas where you are very limited, space-wise. If you, for example, want to put Mixxx directly into a controller’s case (like this one) and run it headlessly you might give it a try.

It will take ~2 minutes from calling the executable until it’s ready. It’s also quite CPU-consuming. The picture shows Mixxx running on a Raspberry Pi Zero in idle-mode:


And just in case you want to run Mixxx in headless mode and/ or you want to save resources by NOT starting an X-server you need Xvfb and this command:

Xvfb :1 -screen 0 1024x768x24 </dev/null &
export DISPLAY=":1"
./mixxx

This also turned out into an interesting thread over at the Mixxx forum.

Tagged , , , , .Speichere in deinen Favoriten diesen permalink.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert