HOWTO Compile MPD With AAC/M4A Support on Ubuntu
MPD is great for remotely controlling your Linux powered entertainment system or, as in my office’s case, to allow 15 staff to each act as work-day DJs.
Our office music server runs Ubuntu 7.10, but the default mpd package for Ubuntu doesn’t have M4A (AAC) support for MPD. Here’s what we did to re-compile MPD.
This tutorial will set you up with a new MPD with support for OSS/ALSA that will play the following formats:
- MP3
- AAC
- OGG Vorbis
- FLAC
- WAV
First, MPD requires libfaad2-dev and libmp4v2-dev to compile with AAC support. I’m using the debian-multimedia repositories to get these packages and they don’t have versions of libfaad2-dev and libmp4v2-dev suitable for Ubuntu 8.10.
No worries, this is a good excuse to learn how to build packages “gentoo style” using apt to build packages from source.
You’ll need the appropriate repositories enabled. Check your /etc/apt/sources.list file to ensure you have at least universe and multiverse enabled. Then add the debian-multimedia repositories. Append the below lines to your /etc/apt/sources.list.
## Debian Multimedia deb http://www.debian-multimedia.org stable main deb-src http://www.debian-multimedia.org stable main deb http://www.debian-multimedia.org testing main deb-src http://www.debian-multimedia.org testing main deb http://www.debian-multimedia.org unstable main deb-src http://www.debian-multimedia.org unstable main
Update your apt package database with an apt-get update. Next,
we need to install the basic dependencies that will allow you to compile the
software.
sudo apt-get install build-essential dpkg-dev \ debhelper libasound2-dev libid3tag0-dev \ ccache libxvidcore4-dev libid3-3.8.3-dev \ libgtk2.0-dev libesd0-dev libsdl1.2-dev \ liba52-dev liblame-dev libxt-dev \ nasm libx264-dev dpatch \ autotools-dev libfaad-dev libvorbis-dev \ libimlib2-dev libfaac-dev texi2html \ libtheora-dev libgsm1-dev libxvmc-dev \ libamrnb-dev libamrwb-dev libsamplerate0-dev \ libflac-dev fakeroot checkinstall \ libmp3lame-dev quilt libdc1394-22-dev \ libdirac-dev libschroedinger-dev
Once that has finished coming down the wire we’re almost ready to start compiling. Let’s get the MPD source code, and some initial dependencies.
sudo mkdir -p /usr/local/src cd /usr/local/src sudo wget http://www.musicpd.org/uploads/files/mpd-0.13.2.tar.gz sudo tar zxvf mpd-0.13.2.tar.gz sudo chown -R "$USER":admin mpd-0.13.2*NOTE: The above snippet download’s mpd version 0.13.2. This is up to date as of November 12, 2008.
Time to compile! We’re using apt-get -b source PACKAGE-NAME to
download and compile the source packages. This is a good way to do things
since it will create DEB packages automatically, plus it’s good Debian form.
I recommend learning how to use this feature of apt.
sudo apt-get -b source libavcodec-dev libavutil-dev sudo dpkg -i *.deb sudo apt-get -b source libmp4v2-0 sudo dpkg -i *.deb
Lastly we compile and install mpd. Run the following commands.
cd mpd-0.13.2 make clean ./configure make sudo checkinstall -D make install sudo ln -s /usr/local/bin/mpd /usr/bin/mpd
If you haven’t received any errors, then you’re good to go!
The MPD Wiki is a good resource for help with the rest of the set up and configuration.
