Building MPD from source

At the time of writing, the current MPD version in Raspbian Jessie is 0.19.1-1.1 (released in 2014), that’s quite old. If you want to have the latest version, this short tutorial describes how to build it from source. Another reason for building MDP from source, instead of using the Raspbian package, is: we can select the features we need and disable the stuff we don’t need, to get a smaller and (hopefully) more performant program.

First, download the latest release tarball from the MPD home page (the version number 0.19.19 is used as an example here):

wget https://www.musicpd.org/download/mpd/0.19/mpd-0.19.19.tar.xz

and extract it:

tar xf mpd-0.19.19.tar.xz
cd mpd-0.19.19/

Next, we need to install the required libraries and build tools:

sudo apt-get install g++ libboost-dev libicu-dev libglib2.0-dev

Depending on the desired MPD configuration some other installations might be required, for example:

sudo apt-get install libsqlite3-dev libmpdclient-dev libexpat1-dev \
  libid3tag0-dev libflac-dev libaudiofile-dev libmad0-dev libmp3lame-dev \
  libasound2-dev libcurl4-gnutls-dev libsystemd-daemon-dev

Now we are going to configure the compilation and, for example, disable some fancy but unneeded features (personal opinion) like re-sampling or audio CD support:

./configure \
  --enable-werror --prefix=/usr --sysconfdir=/etc \
  --with-systemdsystemunitdir=/etc/systemd/system --enable-systemd-daemon \
  --enable-database --enable-sqlite --enable-libmpdclient --enable-expat --enable-syslog \
  --enable-alsa --disable-oss --enable-icu --enable-glib \
  --enable-flac --enable-audiofile --enable-dsd --enable-mad --enable-id3 --enable-curl \
  --enable-mms=no --enable-smbclient=no --enable-nfs=no --enable-zlib=no --enable-bzip2=no \
  --enable-roar=no --enable-ao=no --enable-vorbis=no --enable-wavpack=no --enable-gme=no \
  --enable-lame-encoder=no --enable-shine-encoder=no \
  --enable-twolame-encoder=no --enable-vorbis-encoder=no --enable-wave-encoder=no \
  --enable-modplug=no --enable-mpc=no --enable-mpg123=no --enable-openal=no \
  --enable-opus=no --enable-sidplay=no --enable-shout=no --enable-adplug=no \
  --enable-sndfile=no --enable-wildmidi=no --enable-soundcloud=no --enable-ffmpeg=no \
  --enable-jack=no --enable-pulse=no --enable-lsr=no --enable-soxr=no --enable-fluidsynth=no \
  --enable-cdio-paranoia=no \
  --enable-recorder-output=no --enable-httpd-output=no --enable-solaris-output=no \
  --enable-libwrap=no --enable-upnp=no --enable-neighbor-plugins=no --with-zeroconf=no \
  --disable-aac

Check the output for errors and warnings. See .\configure --help for details about available options. If the script completes successfully, you should see an output like this:

File format support:
	(-AAC) (-AdPlug) (+DSD) (-C64 SID) (-FFMPEG) (+FLAC) (-FluidSynth) (-GME) 
	(-libsndfile) (-MikMod) (-MODPLUG) (+MAD) (-MPG123) (-Musepack) 
	(-Opus) (-OggTremor) (-OggVorbis) (+WAVE) (-WavPack) (-WildMidi)

A ‘+‘-character means that the corresponding option is enabled, a ‘-‘-character means that the corresponding option is disabled. Here, for example, the support for flac-files is enabled, while the support for opus-files is disabled.

Finally, compile the program:

make

and install it:

sudo make install

References

  1. MPD Installation Documentation