{"id":5422,"date":"2018-11-06T05:05:47","date_gmt":"2018-11-06T04:05:47","guid":{"rendered":"https:\/\/andyland.info\/wordpress\/?p=5422"},"modified":"2018-11-01T08:57:54","modified_gmt":"2018-11-01T07:57:54","slug":"building-mixxx-2-2-for-raspberry-pi-zero","status":"publish","type":"post","link":"https:\/\/andyland.info\/wordpress\/building-mixxx-2-2-for-raspberry-pi-zero\/","title":{"rendered":"Building Mixxx 2.2 for Raspberry Pi Zero"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A few weeks ago I successfully managed to <a href=\"https:\/\/andyland.info\/wordpress\/?p=4807\">build Mixxx 2.x on a Raspberry Pi 3<\/a>. Once I got that done I immediately identified &#8220;more than enough\u201d (that is: one) situations where it would be great to have yet a smaller piece of hardware to run <a href=\"https:\/\/mixxx.org\">Mixxx<\/a> on (placing a link. Just in case you might not already know what we&#8217;re talking about). That&#8217;s why I think running Mixxx on a Raspberry PI Zero ist the next logical consequence.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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. <br><\/p>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\">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&#8217;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&#8217;ll come to that later.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Of course, in order to build Mixxx at all you have to take all steps as <a href=\"https:\/\/andyland.info\/wordpress\/?p=4807\">described in the other post<\/a>&nbsp;&#8220;sudo apt-get install&#8221; all that stuff.&nbsp; <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since we&#8217;re talking Mixxx 2.2 here our command-line for pulling from the git repo needs to be<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone -b 2.2 https:\/\/github.com\/mixxxdj\/mixxx.git<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Second: Optimization is key. In the previous post the commandline for building Mixxx on a RPI 3 was:<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo scons -c &amp;&amp; sudo scons -j 3 opengles=1 staticlibs=1 optimize=native<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">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 &#8220;Pi3&#8221;-Mixxx on a Pi Zero I was greeted with<br><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>&#8220;Invalid Instructions&#8221;<br><\/p><p>&#8220;Ung\u00fcltiger Maschinenbefehl&#8221;<br><\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">This is kind of comprehensible: The Raspberry Pi 3+ and Zero are built around different hardware.&nbsp; (Broadcom BCM2837B0 instead of BCM2835). Optimizing it for one platform will probably cause &#8216;something&#8217; on the other one. That&#8217;s what we&#8217;re seeing here (at least that&#8217;s what I think). One workaround is to simply turn off optimization: <br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo scons -c &amp;&amp; sudo scons -j 1 opengles=1 staticlibs=0 optimize=off<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"text-align:left\">This works. <strong>Turning off optimization enables you to build Mixxx 2.2 on a Raspberry Pi 3 and run it on a Pi Zero<\/strong>. It will take ~1 hour to build Mixxx 2.2 on a Raspberry Pi 3. Great. We got a working binary now.<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since we are on a somewhat tight CPU budget (and since we&#8217;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&#8217;s memory split to 256 MB.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"732\" height=\"438\" src=\"https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/rpiZero_memSplit.png\" alt=\"\" class=\"wp-image-5501\" srcset=\"https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/rpiZero_memSplit.png 732w, https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/rpiZero_memSplit-300x180.png 300w, https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/rpiZero_memSplit-150x90.png 150w, https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/rpiZero_memSplit-250x150.png 250w\" sizes=\"auto, (max-width: 732px) 100vw, 732px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Next: expand the swap file. If you ommit this step the build process will exit on various occasions with errors like this:<br><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><em>Error: open CFI at the end of file; missing .cfi_endproc directive<\/em><\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Setting the swap-file&#8217;s size is simply done by editing the file <strong>\/etc\/dphys-swapfile<\/strong>&nbsp;. Find the line that says<br><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>CONF_SWAPSIZE=100<\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">and change it to <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>CONF_SWAPSIZE=1024<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"732\" height=\"438\" src=\"https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/rpiZeroSwap.png\" alt=\"\" class=\"wp-image-5504\" srcset=\"https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/rpiZeroSwap.png 732w, https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/rpiZeroSwap-300x180.png 300w, https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/rpiZeroSwap-150x90.png 150w, https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/rpiZeroSwap-250x150.png 250w\" sizes=\"auto, (max-width: 732px) 100vw, 732px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Do a reboot and afterwards you are good to go and compile Mixxx on the Raspberry Pi Zero. Be sure to NOT optimize it. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Mixxx 2.2 will only compile on a Raspberry Pi Zero if you build it with this command line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo scons -c &amp;&amp; sudo scons -j 3 opengles=1 staticlibs=1 optimize=off<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The important bit is <strong>optimize=off<\/strong>. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you did everything right you will be presented with a shiny new version of Mixxx after approximately 16 hours. That&#8217;s right. <strong>Building Mixxx on a Raspberry Pi Zero will take about 16 hours<\/strong>. Better be sure to have everything set up correctly beforehand &#8211; or end up like me &#8230; running back and forth between your computers for 10 days in a row.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Why would anyone do that?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">All this effort might be &#8220;sensible&#8221; in areas where you are very limited, space-wise. If you, for example, want to put Mixxx directly into a controller&#8217;s case (<a href=\"https:\/\/andyland.info\/wordpress\/?p=4668\">like this one<\/a>) and run it headlessly you might give it a try. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It will take ~2 minutes from calling the executable until it&#8217;s ready. It&#8217;s also quite CPU-consuming. The picture shows Mixxx running on a Raspberry Pi Zero in idle-mode:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"732\" height=\"438\" src=\"https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/piZero_CPU_marked.jpg\" alt=\"\" class=\"wp-image-5584\" srcset=\"https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/piZero_CPU_marked.jpg 732w, https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/piZero_CPU_marked-300x180.jpg 300w, https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/piZero_CPU_marked-150x90.jpg 150w, https:\/\/andyland.info\/wordpress\/wp-content\/uploads\/piZero_CPU_marked-250x150.jpg 250w\" sizes=\"auto, (max-width: 732px) 100vw, 732px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><br>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:<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Xvfb :1 -screen 0 1024x768x24 &lt;\/dev\/null &amp;\nexport DISPLAY=\":1\"\n.\/mixxx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This also turned out into an interesting thread over at the <a href=\"https:\/\/www.mixxx.org\/forums\/viewtopic.php?f=1&amp;t=12182\">Mixxx forum<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8220;more than enough\u201d (that is: one) situations where it would be great to have yet a smaller piece of hardware to run Mixxx on (placing a \u2026 <a class=\"continue-reading-link\" href=\"https:\/\/andyland.info\/wordpress\/building-mixxx-2-2-for-raspberry-pi-zero\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[19,5,24],"tags":[381,348,58,369,120],"class_list":["post-5422","post","type-post","status-publish","format-standard","hentry","category-musik","category-projekte","category-raspberry-pi","tag-headless","tag-mixxx","tag-raspberry-pi-2","tag-raspberry-pi-zero","tag-rpi","odd"],"_links":{"self":[{"href":"https:\/\/andyland.info\/wordpress\/wp-json\/wp\/v2\/posts\/5422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/andyland.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/andyland.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/andyland.info\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/andyland.info\/wordpress\/wp-json\/wp\/v2\/comments?post=5422"}],"version-history":[{"count":0,"href":"https:\/\/andyland.info\/wordpress\/wp-json\/wp\/v2\/posts\/5422\/revisions"}],"wp:attachment":[{"href":"https:\/\/andyland.info\/wordpress\/wp-json\/wp\/v2\/media?parent=5422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/andyland.info\/wordpress\/wp-json\/wp\/v2\/categories?post=5422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/andyland.info\/wordpress\/wp-json\/wp\/v2\/tags?post=5422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}