# Ports

Binary packages of MPlayer are available from several sources. We have a list of places to get unofficial packages for various systems on our homepage. However, none of these packages are supported. Report problems to the authors, not to us.

## Linux

### Debian packaging

To build a Debian package, run the following command in the MPlayer source directory:

    fakeroot debian/rules binary

If you want to pass custom options to configure, you can set up the `DEB_BUILD_OPTIONS` environment variable. For instance, if you want GUI and OSD menu support you would use:

    DEB_BUILD_OPTIONS="--enable-gui --enable-menu" fakeroot debian/rules binary

You can also pass some variables to the Makefile. For example, if you want to compile with gcc 3.4 even if it's not the default compiler:

    CC=gcc-3.4 DEB_BUILD_OPTIONS="--enable-gui" fakeroot debian/rules binary

To clean up the source tree run the following command:

    fakeroot debian/rules clean

As root you can then install the `.deb` package as usual:

    dpkg -i ../mplayer_version.deb

### RPM packaging

To build an RPM package, run the following command in the MPlayer source directory:

    FIXME: insert proper commands here

### ARM Linux

MPlayer works on Linux PDAs with ARM CPU e.g. Sharp Zaurus, Compaq Ipaq. The easiest way to obtain MPlayer is to get it from one of the OpenZaurus package feeds. If you want to compile it yourself, you should look at the mplayer and the libavcodec directory in the OpenZaurus distribution buildroot. These always have the latest Makefile and patches used for building a SVN MPlayer. If you need a GUI frontend, you can use xmms-embedded.

## *BSD

MPlayer runs on all known BSD flavors. There are ports/pkgsrc/fink/etc versions of MPlayer available that are probably easier to use than our raw sources.

If MPlayer complains about not finding `/dev/cdrom` or `/dev/dvd`, create an appropriate symbolic link:

    ln -s /dev/your_cdrom_device /dev/cdrom

To use Win32 DLLs with MPlayer you will need to re-compile the kernel with "`option USER_LDT`" (unless you run FreeBSD-CURRENT, where this is the default).

### FreeBSD

If your CPU has SSE, recompile your kernel with "`options CPU_ENABLE_SSE`" (FreeBSD-STABLE or kernel patches required).

### OpenBSD

Due to limitations in different versions of gas (relocation vs MMX), you will need to compile in two steps: First make sure that the non-native as is first in your `$PATH` and do a `gmake -k`, then make sure that the native version is used and do `gmake`.

As of OpenBSD 3.4 the hack above is no longer needed.

### Darwin

See the Mac OS section.

## Commercial Unix

MPlayer has been ported to a number of commercial Unix variants. Since the development environments on these systems tend to be different from those found on free Unixes, you may have to make some manual adjustments to make the build work.

### Solaris

Solaris still has broken, POSIX-incompatible system tools and shell in default locations. Until a bold step out of the computing stone age is made, you will have to add `/usr/xpg4/bin` to your PATH.

MPlayer should work on Solaris 2.6 or newer. Use the SUN audio driver with the `-ao sun` option for sound.

On UltraSPARCs, MPlayer takes advantage of their VIS extensions (equivalent to MMX), currently only in libmpeg2, libvo and libavcodec. You can watch a VOB file on a 400MHz CPU. You'll need mLib installed.

Caveat:

- mediaLib is currently disabled by default in MPlayer because of brokenness. SPARC users who build MPlayer with mediaLib support have reported a thick, green-tint on video encoded and decoded with libavcodec. You may enable it if you wish with:

      ./configure --enable-mlib

  You do this at your own risk. x86 users should never use mediaLib, as this will result in very poor MPlayer performance.

On Solaris SPARC, you need the GNU C/C++ Compiler; it does not matter if GNU C/C++ compiler is configured with or without the GNU assembler.

On Solaris x86, you need the GNU assembler and the GNU C/C++ compiler, configured to use the GNU assembler! The MPlayer code on the x86 platform makes heavy use of MMX, SSE and 3DNOW! instructions that cannot be compiled using Sun's assembler `/usr/ccs/bin/as`.

The `configure` script tries to find out, which assembler program is used by your "gcc" command (in case the autodetection fails, use the `--as=/wherever/you/have/installed/gnu-as` option to tell the `configure` script where it can find GNU "as" on your system).

Solutions to common problems:

- Error message from `configure` on a Solaris x86 system using GCC without GNU assembler:

      % configure
      ...
      Checking assembler (/usr/ccs/bin/as) ... , failed
      Please upgrade(downgrade) binutils to 2.10.1...

  (Solution: Install and use a gcc configured with `--with-as=gas`)

  Typical error you get when building with a GNU C compiler that does not use GNU as:

      % gmake
      ...
      gcc -c -Iloader -Ilibvo -O4 -march=i686 -mcpu=i686 -pipe -ffast-math
          -fomit-frame-pointer  -I/usr/local/include   -o mplayer.o mplayer.c
      Assembler: mplayer.c
      "(stdin)", line 3567 : Illegal mnemonic
      "(stdin)", line 3567 : Syntax error
      ... more "Illegal mnemonic" and "Syntax error" errors ...

- MPlayer may segfault when decoding and encoding video that uses the win32codecs:

      ...
      Trying to force audio codec driver family acm...
      Opening audio decoder: [acm] Win32/ACM decoders
      sysi86(SI86DSCR): Invalid argument
      Couldn't install fs segment, expect segfault

      MPlayer interrupted by signal 11 in module: init_audio_codec
      ...

  This is because of a change to sysi86() in Solaris 10 and pre-Solaris Nevada b31 releases. This has been fixed in Solaris Nevada b32; however, Sun has yet to backport the fix to Solaris 10. The MPlayer Project has made Sun aware of the problem and a patch is currently in progress for Solaris 10. More information about this bug can be found at: .

- Due to bugs in Solaris 8, you may not be able to play DVD discs larger than 4 GB:

  - The sd(7D) driver on Solaris 8 x86 has a bug when accessing a disk block >4GB on a device using a logical blocksize != DEV_BSIZE (i.e. CD-ROM and DVD media). Due to a 32Bit int overflow, a disk address modulo 4GB is accessed (). This problem does not exist in the SPARC version of Solaris 8.

  - A similar bug is present in the hsfs(7FS) file system code (AKA ISO9660), hsfs may not not support partitions/disks larger than 4GB, all data is accessed modulo 4GB (). The hsfs problem can be fixed by installing patch 109764-04 (SPARC) / 109765-04 (x86).

### HP-UX

Joe Page hosts a detailed HP-UX MPlayer HOWTO by Martin Gansser on his homepage. With these instructions the build should work out of the box. The following information is taken from this HOWTO.

You need GCC 3.4.0 or later and SDL 1.2.7 or later. HP cc will not produce a working program, prior GCC versions are buggy. For OpenGL functionality you need to install Mesa and the gl and gl2 video output drivers should work, speed may be very bad, depending on the CPU speed, though. A good replacement for the rather poor native HP-UX sound system is GNU esound.

Create the DVD device scan the SCSI bus with:

    # ioscan -fn

    Class          I            H/W   Path          Driver    S/W State    H/W Type        Description
    ...
    ext_bus 1    8/16/5      c720  CLAIMED INTERFACE  Built-in SCSI
    target  3    8/16/5.2    tgt   CLAIMED DEVICE
    disk    4    8/16/5.2.0  sdisk CLAIMED DEVICE     PIONEER DVD-ROM DVD-305
                             /dev/dsk/c1t2d0 /dev/rdsk/c1t2d0
    target  4    8/16/5.7    tgt   CLAIMED DEVICE
    ctl     1    8/16/5.7.0  sctl  CLAIMED DEVICE     Initiator
                             /dev/rscsi/c1t7d0 /dev/rscsi/c1t7l0 /dev/scsi/c1t7l0
    ...

The screen output shows a Pioneer DVD-ROM at SCSI address 2. The card instance for hardware path 8/16 is 1.

Create a link from the raw device to the DVD device.

    ln -s /dev/rdsk/c<SCSI bus instance>t<SCSI target ID>d<LUN> /dev/<device>

Example:

    ln -s /dev/rdsk/c1t2d0 /dev/dvd

Below are solutions for some common problems:

- Crash at Start with the following error message:

      /usr/lib/dld.sl: Unresolved symbol: finite (code) from /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.2/../../../libGL.sl

  This means that the function .finite(). is not available in the standard HP-UX math library. Instead there is .isfinite().. Solution: Use the latest Mesa depot file.

- Crash at playback with the following error message:

      /usr/lib/dld.sl: Unresolved symbol: sem_init (code) from /usr/local/lib/libSDL-1.2.sl.0

  Solution: Use the extralibdir option of configure `--extra-ldflags="/usr/lib -lrt"`

- MPlayer segfaults with a message like this:

      Pid 10166 received a SIGSEGV for stack growth failure.
      Possible causes: insufficient memory or swap space, or stack size exceeded maxssiz.
      Segmentation fault

  Solution: The HP-UX kernel has a default stack size of 8MB(?) per process.(11.0 and newer 10.20 patches let you increase maxssiz up to 350MB for 32-bit programs). You need to extend maxssiz and recompile the kernel (and reboot). You can use SAM to do this. (While at it, check out the maxdsiz parameter for the maximum amount of data a program can use. It depends on your applications, if the default of 64MB is enough or not.)

### AIX

MPlayer builds successfully on AIX 5.1, 5.2, and 5.3, using GCC 3.3 or greater. Building MPlayer on AIX 4.3.3 and below is untested. It is highly recommended that you build MPlayer using GCC 3.4 or greater, or if you are building on POWER5, GCC 4.0 is required.

CPU detection is still a work in progress. The following architectures have been tested:

- 604e

- POWER3

- POWER4

The following architectures are untested, but should still work:

- POWER

- POWER2

- POWER5

Sound via the Ultimedia Services is not supported, as Ultimedia was dropped in AIX 5.1; therefore, the only option is to use the AIX Open Sound System (OSS) drivers from 4Front Technologies at http://www.opensound.com/aix.html. 4Front Technologies freely provides OSS drivers for AIX 5.1 for non-commercial use; however, there are currently no sound output drivers for AIX 5.2 or 5.3. This means AIX 5.2 and 5.3 are not capable of MPlayer audio output, presently.

Solutions to common problems:

- If you encounter this error message from `./configure`:

      $ ./configure
      ...
      Checking for iconv program ... no
      No working iconv program found, use
      --charset=US-ASCII to continue anyway.
      Messages in the GTK-2 interface will be broken then.

  This is because AIX uses non-standard character set names; therefore, converting MPlayer output to another character set is currently not supported. The solution is to use:

      $ ./configure --charset=noconv

### QNX

You'll need to download and install SDL for QNX. Then run MPlayer with `-vo sdl:driver=photon` and `-ao sdl:nto` options, it should be fast.

The `-vo x11` output will be even slower than on Linux, since QNX has only X emulation which is very slow.

## Windows

Yes, MPlayer runs on Windows under Cygwin and MinGW. It does not have an official GUI yet, but the command line version is completely functional. You should check out the MPlayer-cygwin mailing list for help and latest information. Official Windows binaries can be found on the download page. Installer packages and simple GUI frontends are available from external sources, we have collected then in the Windows section of our projects page.

If you wish to avoid using the command line, a simple trick is to put a shortcut on your desktop that contains something like the following in the execute section:

    c:\path\to\mplayer.exe %1

This will make MPlayer play any movie that is dropped on the shortcut. Add `-fs` for fullscreen mode.

Best results are achieved with the native DirectX video output driver (`-vo directx`). Alternatives are OpenGL and SDL, but OpenGL performance varies greatly between systems and SDL is known to distort video or crash on some systems. If the image is distorted, try turning off hardware acceleration with `-vo directx:noaccel`. Download DirectX 7 header files to compile the DirectX video output driver. Furthermore you need to have DirectX 7 or later installed for the DirectX video output driver to work.

VIDIX now works under Windows as `-vo winvidix`, although it is still experimental and needs a bit of manual setup. Download dhahelper.sys or dhahelper.sys (with MTRR support) and copy it to the `vidix/dhahelperwin` directory in your MPlayer source tree. Open a console and type

    make install-dhahelperwin

as Administrator. After that you will have to reboot.

For best results MPlayer should use a colorspace that your video card supports in hardware. Unfortunately many Windows graphics drivers wrongly report some colorspaces as supported in hardware. To find out which, try

    mplayer -benchmark -nosound -frames 100 -vf format=colorspace movie

where colorspace can be any colorspace printed by the `-vf format=fmt=help` option. If you find a colorspace your card handles particularly bad `-vf noformat=colorspace` will keep it from being used. Add this to your config file to permanently keep it from being used.

There are special codec packages for Windows available on our download page to allow playing formats for which there is no native support yet. Put the codecs somewhere in your path or pass `--codecsdir=c:/path/to/your/codecs` (alternatively `--codecsdir=/path/to/your/codecs` only on Cygwin) to `configure`. We have had some reports that Real DLLs need to be writable by the user running MPlayer, but only on some systems (NT4). Try making them writable if you have problems.

You can play VCDs by playing the `.DAT` or `.MPG` files that Windows exposes on VCDs. It works like this (adjust for the drive letter of your CD-ROM):

    mplayer d:/mpegav/avseq01.dat

Alternatively, you can play a VCD track directly by using:

    mplayer vcd://<track> -cdrom-device d:

DVDs also work, adjust `-dvd-device` for the drive letter of your DVD-ROM:

    mplayer dvd://<title> -dvd-device d:

The Cygwin/MinGW console is rather slow. Redirecting output or using the `-quiet` option has been reported to improve performance on some systems. Direct rendering (`-dr`) may also help. If playback is jerky, try `-autosync 100`. If some of these options help you, you may want to put them in your config file.

If you have a Pentium 4 and are experiencing a crash using the RealPlayer codecs, you may need to disable hyperthreading support.

### Cygwin

You need to run Cygwin 1.5.0 or later in order to compile MPlayer.

DirectX header files need to be extracted to `/usr/include/` or `/usr/local/include/`.

Instructions and files for making SDL run under Cygwin can be found on the libsdl site.

### MinGW

You need MinGW 3.1.0 or later and MSYS 1.0.9 or later. Tell the MSYS postinstall that MinGW is installed.

Extract DirectX header files to `/mingw/include/`.

MOV compressed header support requires zlib, which MinGW does not provide by default. Configure it with `--prefix=/mingw` and install it before compiling MPlayer.

Complete instructions for building MPlayer and necessary libraries can be found in the MPlayer MinGW HOWTO.

## Mac OS

MPlayer does not work on Mac OS versions before 10, but should compile out-of-the-box on Mac OS X 10.2 and up. The preferred compiler is the Apple version of GCC 3.x or later. You can get the basic compilation environment by installing Apple's Xcode. If you have Mac OS X 10.3.9 or later and QuickTime 7 you can use the `corevideo` video output driver.

Unfortunately, this basic environment will not allow you to take advantage of all the nice features of MPlayer. For instance, in order to have OSD support compiled in, you will need to have fontconfig and freetype libraries installed on your machine. Contrary to other Unixes such as most Linux and BSD variants, OS X does not have a package system that comes with the system.

There are at least two to choose from: Fink and MacPorts. Both of them provide about the same service (i.e. a lot of packages to choose from, dependency resolution, the ability to simply add/update/remove packages, etc...). Fink offers both precompiled binary packages or building everything from source, whereas MacPorts only offers building from source. The author of this guide chose MacPorts for the simple fact that its basic setup was more lightweight. Later examples will be based on MacPorts.

For instance, to compile MPlayer with OSD support:

    sudo port install pkg-config

This will install pkg-config, which is a system for managing library compile/link flags. MPlayer's configure script uses it to properly detect libraries. Then you can install fontconfig in a similar way:

    sudo port install fontconfig

Then you can proceed with launching MPlayer's configure script (note the PKG_CONFIG_PATH and PATH environment variables so that configure finds the libraries installed with MacPorts):

    PKG_CONFIG_PATH=/opt/local/lib/pkgconfig/ PATH=$PATH:/opt/local/bin/ ./configure

### MPlayer OS X GUI

You can get a native GUI for MPlayer together with precompiled MPlayer binaries for Mac OS X from the MPlayerOSX project, but be warned: that project is not active anymore.

Fortunately, MPlayerOSX has been taken over by a member of the MPlayer team. Preview releases are available from our download page and an official release should arrive soon.

In order to build MPlayerOSX from source yourself, you need the mplayerosx, the main and a copy of the main SVN module named main_noaltivec. mplayerosx is the GUI frontend, main is MPlayer and main_noaltivec is MPlayer built without AltiVec support.

To check out SVN modules use:

    svn checkout svn://svn.mplayerhq.hu/mplayerosx/trunk/ mplayerosx
    svn checkout svn://svn.mplayerhq.hu/mplayer/trunk/ main

In order to build MPlayerOSX you will need to set up something like this:

    MPlayer_source_directory
       |
       |--->main           (MPlayer Subversion source)
       |
       |--->main_noaltivec (MPlayer Subversion source configured with --disable-altivec)
       |
       \--->mplayerosx     (MPlayer OS X Subversion source)

You first need to build main and main_noaltivec.

To begin with, in order to ensure maximum backwards compatibility, set an environment variable:

    export MACOSX_DEPLOYMENT_TARGET=10.3

Then, configure:

If you configure for a G4 or later CPU with AltiVec support, do as follows:

    ./configure --disable-gl --disable-x11

If you configure for a G3-powered machine without AltiVec, use:

    ./configure --disable-gl --disable-x11 --disable-altivec

You may need to edit `config.mak` and change -mcpu and -mtune from 74XX to G3.

Continue with

    make

then go to the mplayerosx directory and type

    make dist

This will create a compressed .dmg archive with the ready to use binary.

You can also use the Xcode 2.1 project; the old project for Xcode 1.x does not work anymore.