Compiling from source
Prev | Chapter 2. Installation | Next

## Compiling from source

Download the source tarball from the MPD home page and unpack it:

    tar xf mpd-version.tar.xz
    cd mpd-version

Make sure that all the required libraries and build tools are installed. The `INSTALL` file has a list.

For example, the following installs a fairly complete list of build dependencies on Debian Wheezy:

    apt-get install g++ \
      libmad0-dev libmpg123-dev libid3tag0-dev \
      libflac-dev libvorbis-dev libopus-dev \
      libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
      libfluidsynth-dev libgme-dev libmikmod2-dev libmodplug-dev \
      libmpcdec-dev libwavpack-dev libwildmidi-dev \
      libsidplay2-dev libsidutils-dev libresid-builder-dev \
      libavcodec-dev libavformat-dev \
      libmp3lame-dev \
      libsamplerate0-dev libsoxr-dev \
      libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev \
      libzzip-dev \
      libcurl4-gnutls-dev libyajl-dev libexpat-dev \
      libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev \
      libpulse-dev libroar-dev libshout3-dev \
      libmpdclient-dev \
      libnfs-dev libsmbclient-dev \
      libupnp-dev \
      libavahi-client-dev \
      libsqlite3-dev \
      libsystemd-daemon-dev libwrap0-dev \
      libcppunit-dev xmlto \
      libboost-dev \
      libicu-dev

Now configure the source tree:

    ./configure

The `--help` argument shows a list of compile-time options. When everything is ready and configured, compile:

    make

And install:

    make install

### Compiling for Windows

Even though it does not "feel" like a Windows application, MPD works well under Windows. Its build process follows the "Linux style", and may seem awkward for Windows people (who are not used to compiling their software, anyway).

Basically, there are three ways to compile MPD for Windows:

1. Build on Windows for Windows. All you need to do is described above already: configure and make.

   For Windows users, this is kind of unusual, because few Windows users have a GNU toolchain and a UNIX shell installed.

2. Build on Linux for Windows. This is described above already: configure and make. You need the mingw-w64 cross compiler. Pass `--host=i686-w64-mingw32` (32 bit) or `--host=x86_64-w64-mingw32` (64 bit) to configure.

   This is somewhat natural for Linux users. Many distributions have mingw-w64 packages. The remaining difficulty here is installing all the external libraries. And MPD usually needs many, making this method cumbersome for the casual user.

3. Build on Linux for Windows using the MPD's library build script.

This section is about the latter.

Just like with the native build, unpack the MPD source tarball and change into the directory. Then, instead of ./configure, type:

    ./win32/build.py --64

This downloads various library sources, and then configures and builds MPD (for x64; to build a 32 bit binary, pass `--32`). The resulting EXE files is linked statically, i.e. it contains all the libraries already, and you do not need carry DLLs around. It is large, but easy to use. If you wish to have a small `mpd.exe` with DLLs, you need to compile manually, without the `build.py` script.

Prev | Up | Next
Chapter 2. Installation | Home | `systemd` socket activation