supervacuo.com

Carl van Tonder

mpd on Fedora ARM

16 November 2014

I don't even want to think about how long I've spent on this project.

Do you have a Raspberry Pi? How about a dogged insistence on running Pidora? And maybe a strong desire to have a possibly-constantly-crashing copy of mpd installed on it?

I have good news!

You might have noticed that RPMFusion does now provide ARM binaries (including for mpd) — unfortunately, they are for armv7 and the Raspberry Pi is only compatible with armv6 — so close! Luckily, through the power of open source it's still possible to get this working: the source RPM is available so you can "just" download and recompile.

Unfortunately, this is not as easy as it might seem:

  1. the Pi itself is flaky and slow — a bad combination for compiling large programs
  2. mpd has a long-ish list of dependencies which aren't available in Pidora (and also need to be recompiled from RPMFusion)
  3. libtool (required by libmad) is uninstallable in Pidora 2014: my uninformed take is that it needs a rebuild against newer gcc
  4. RPMFusion packages have a dependency loop: ffmpeg has a BuildRequires: x264-devel and x264 has BuildRequires: ffmpeg-devel. Awesome!

My solution to #1 was to enter a whole other world of pain getting a virtual Raspberry Pi running. You, lucky soul, can just install my packages.

If you want or need to rebuild the packages yourself, read on.

First, set up RPMFusion as a package source: download my tweaked repository as follows (there's no point setting up their actual repositories as they're for the wrong architecture):

$ wget http://supervacuo.com/fedora/rpmfusion-all-source.repo
$ sudo mv rpmfusion-all-source.repo /etc/yum.repos.d/

Next, if you haven't already, set up an RPM building environment:

$ sudo yum install rpmbuild rpmdevtools yum-utils

and download and install all the source RPMs you'll need:

$ yumdownloader --source --noplugins --enablerepo=rpmfusion-\* \
    faad2 ffmpeg lame libmad libmms libtool rtmpdump x264 xvidcore
$ rpm -ivh *.rpm

Next, try to satisfy all the dependencies you can up-front:

 $ sudo yum install id3lib xmms-devel xmms-libs libsysfs-devel \
      sqlite-devel systemd-devel jack-audio-connection-kit-devel \
      libsamplerate-devel zziplib-devel libao-devel flac-devel \
      libcurl-devel wavpack-devel libshout-devel avahi-glib-devel \
      libid3tag-devel yajl-devel libmikmod-devel audiofile-devel yajl \
      avahi-devel libshout openal-soft-devel libv4l-devel \
      opencv-devel frei0r-devel libass-devel soxr-devel libvpx-devel \
      libmodplug-devel pulseaudio-libs-devel openal-soft glib2-devel \
      libmodplug libvpx soxr harfbuzz-devel libicu-devel \
      frei0r-plugins gavl libgdither libass opencv OpenEXR-libs \
      enca-devel ilmbase opencv-core libv4l enca opus-devel \
      libcdio-paranoia-devel fribidi-devel fontconfig-devel \
      expat-devel libcdio-devel freetype-devel librtmp-devel \
      libgcrypt-devel  gnutls-devel gnutls-dane unbound-libs libevent \
      gnutls-c++ ldns libgpg-error-devel libtasn1-devel nettle-devel \
      gmp-devel p11-kit-devel yasm gtk+-devel gtk+ ncurses-devel \
      glib-devel glib libXi-devel libXt-devel libSM-devel libICE-devel \
      subversion speex-devel bzip2-devel gsm-devel \
      libvorbis-devel libtheora-devel libdc1394-devel dirac-devel \
      schroedinger-devel texi2html openjpeg-devel SDL-devel \
      libvdpau-devel libvdpau mesa-libGLU-devel \
      orc-devel libdrm-devel xorg-x11-proto-devel libogg-devel

Ouch! This will pull in yet more stuff, and things may yet be missing. If you encounter error: Failed build dependencies later on, try running sudo yum-builddep PACKAGE.spec to fill the gaps, and consider leaving a comment here to share what I forgot.

Now you'll need to get your hands dirty to get an installable copy of libtool: edit libtool.spec and change %global gcc_version 4.8.3 to %global gcc_version 4.8.2, then update the changelog:

$ rpmdev-bumpspec -u "Carl van Tonder <carl>" \
    -c "%%global gcc_version 4.8.3 to 4.8.2 for pidora...for now." libtool.spec

and rebuild libtool:

$ rpmbuild -bb libtool.spec

The RPM will end up in ~/rpmbuild/RPMS/armv6hl/, so you can install with:

$ sudo yum localinstall ~/rpmbuild/RPMS/armv6hl/libtool-2*.rpm

Now, follow these steps (rpmbuild -bb followed by yum localinstall for all the other .spec files you have. Two notes:

  1. You need to build the packages in order. If rpmbuild says you're missing build requirements and yum-builddep says it can't find a package then you are probably building in the wrong order. From bash logs and vague memory, the order is:

    • any order: lame / libmad / x264 (see below)
    • faad2
    • ffmpeg
    • mpd
  2. you can break out of the x264/ffmpeg requirement loop by building x264 with the with_bootstrap option set, i.e.

    $ rpmbuild -bb x264.spec --define '_with_bootstrap 1'
    

This information from a mailing list post, not the relevant RPMFusion wiki page….

The whole pile works for running mpd but I can't recommend the x264 package or the related ffmpeg packages for general use as I'm pretty sure crucial features are missing: I haven't actually been able to compile a non-bootstrap x264 — it requires gpac, which requires a52dec, which crashes during build:

imdct.c: In function 'a52_imdct_init':
imdct.c:365:6: internal compiler error: Aborted
 void a52_imdct_init (uint32_t mm_accel)
      ^

Finally, I should also warn any odd souls trying this whole procedure for the purposes of actually listening to music instead of sysadmin masochism that mpd seems to hang every few song changes.

Without further ado, then, the packages!

http://ge.tt/6nhjrf42

Comments