Jon Simpson

Compiling mplayer-cvs on Mac OS X 10.4 Tiger

5 Dec 2005 — mplayer, macosx, tiger, compilation

This is a simple/step-by-step guide to building mplayer’s CVS on Mac OS X 10.4 Tiger. There seem to be quite a few issues going around about this and I have experienced quite a few of them first hand…

First off, checking that you’re 100% up to date on your Mac OS X & XCode Tools versions is a good thing to do. I’m running pretty much the latest stuff available at this point, which happens to be Mac OS X 10.4.3 and XCode tools 2.2 (available through ADC from a free sign up, worth it if you plan to compile stuff on OS X…) The gcc_select command will let you see what compiler is set as your system default, you’ll want GCC 4 on Tiger.

$ gcc_select
Current default compiler:
gcc version 4.0.1 (Apple Computer, Inc. build 5247)

The above is the output from my system, you can set the compiler for your system to use using gcc_select, see gcc_select --help for instructions how to do that if its not set correctly. (Fixing permissions in Disk Utility used to change the target of the symlink that is set by gcc_select to the 3.3 series compiler, so its entirely possible your system could be set up wrong).

Once you know you have a good build chain, you can begin to grab all of the sources necessary to build a copy of mplayer. I’m going to work in a directory called ‘src’ in my home directory for the following example.

$ mkdir mplayer-cvs-build
$ cd mplayer-cvs-build
$ mkdir mplayer-src
$ mkdir ffmpeg-src
$ cd mplayer-src
$ cvs login
(hit enter when prompted for a password)
$ cvs -z3 co -P main
$ cd ..
$ cd ffmpeg-src
$ cvs login
(again, hit enter when prompted for a password)
$ cvs -z3 co ffmpeg
$ cd ..
$ ls
mplayer-src ffmpeg-src

The above series of commands will create a useful directory structure for storing the two source trees you need to combine a functional mplayer source tree (with the additional pieces from ffmpeg that make it useful). I choose to have a parent directory, then a directory for each of the two source trees, to keep everything clean. Now you will want to copy libavcodec, libavformat and libavutil out of ffmpeg and into the mplayer source tree. (the earlier commands checked the code out into ffmpeg-src/ffmpeg)

$ cd ffmpeg-src/ffmpeg
$ cp -R libavcodec ~/src/mplayer-cvs-build/mplayer-src/main/
$ cp -R libavformat ~/src/mplayer-cvs-build/mplayer-src/main/
$ cp -R libavutil ~/src/mplayer-cvs-build/mplayer-src/main/

Now its worth editing the CVS files for your mplayer-cvs tree to include auto updates for these 3 directories when you update your mplayer source tree, since it makes updating your build from CVS a lot easier. Edit main/CVS/Entries in your mplayer-cvs tree (in my example, its ~/src/mplayer-cvs-build/mplayer-src/main/CVS/Entries) and add the following three lines after everything already in that file.


This modification makes it a simple cvs -z3 update -dPA in your main/ directory whenever you want to sync your build to the latest CVS (including all of the things from ffmpeg, most notably the libavcodec codecs). Now the directory mplayer-src has a cvs tree that we can build to create a functional mplayer, but we can pass some parameters and set an environment variable to let ./configure detect certain parts of Mac OS X that will let it do truetype font support (without having to get and build fontconfig/freetype yourself..). Use these commands in your ‘main’ directory in the source tree (above, it would be ~/src/mplayer-cvs-build/mplayer-src/main)

export PKG_CONFIG_PATH="/usr/X11R6/lib/pkgconfig/"
./configure --with-freetype-config=/usr/X11R6/bin/freetype-config

Then after configure completes detecting all of the things, you can simply type make to build mplayer. My build worked just fine, and a further make install will locate it in /usr/local/bin, where you can use mplayer and mencoder just like any other system command in the terminal. Note that when your build has finished, you may not get an explicit message telling you so. I’m sure mplayer used to/does, but I don’t seem to any more.. Instead i get the last line of output from the build, like:

Libraries/libGL.dylib(gll_api.o) definition of _glPointParameteriv
/usr/X11R6/lib/libGL.dylib(dri_dispatch.o) definition of

You can verify that an mplayer binary was build by typing ./mplayer --version in the main directory of your source tree. If it runs successfully, the first line will consist of something like:

MPlayer dev-CVS-051205-00:59-4.0.1 (C) 2000-2005 MPlayer Team

This line contains the date and time of your CVS checkout, allowing you to know what version is built. Once your binaries exist, make install them to use them system wide (using them in MPlayer OS X GUI is another issue, that I might come back to some other day, personally I don’t use the GUI so much..). I hope this helps some people out, especially the two guys who commented on my previous posting about compiling mplayer on Mac OS X 10.4 Tiger. I’d be more than happy to hear any feedback or comments on this post using the comments below.


Interestingly, when i performed the same cvs command i got 051204 instead of 051205. when i try to compile this 1204 build i get opengl dylib errors below. any suggestions as to an alternative source to get the 051205 version?

libGL.dylib(gll_api.o) definition of _glPointParameteri
/usr/X11R6/lib/libGL.a(dri_dispatch.o) definition of
_glPointParameteri in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _glPointParameteriv
/libGL.dylib(gll_api.o) definition of _glPointParameteriv
/usr/X11R6/lib/libGL.a(dri_dispatch.o) definition of
_glPointParameteriv in section (__TEXT,__text)
collect2: ld returned 1 exit status

Alexander Wehr, 05 Dec 2005

Oh.. never mind.. it seems to be the same error upon further scrutiny.. but the player does not build. without -disable-gl. On the plus side it works fine, but does not seem to like the config options you’ve laid out for the subtitles.

Alexander Wehr, 05 Dec 2005

This is really strange, I have no idea why a clean compile should run into those GL errors, but I’ll try it on another Mac I have around to see if I can replicate the issue.

The 051204/051205 thing is probably just your system timezone being different, a cvs checkout at any given time will be the same.

export PKG_CONFIG_PATH="/usr/X11R6/lib/pkgconfig/"
./configure –with-freetype-config=/usr/X11R6/bin/freetype-config

In the ./configure output you should see lines relating to freetype and fontconfig stating the two features are enabled.

Jon, 06 Dec 2005

Could the gl libraries differ based on whether it’s a g4 or g5? This sounds like something which apple would try to have 64 bit optimized despite the same architecture across both chips.. but then again this is pure hypothesis on my part.

On the freetype issue - I’ve been advised by other friends to try a fink install of freetype. It’s not been bothersome enough for that yet though. another bit of strangeness - I had to make a .bashrc file and alter some paths to make mplayer executable without the full pathname. maybe I’ve done something weird to my shell prefs to cause a failure of the app to register? p.s. do you mind if i link this post in to a media forum to assist some people? =)

Alexander Wehr, 08 Dec 2005

Feel free to link this post, if the information in it can help other people out there that’s a good thing.

As for the path thing, you’re right, I probably have a different path to that which ships with OS X (most notably, already having /usr/local/bin in my path) Freetype is provided by Apple bundled in with the X11 components of the OS, so I just drew on that version by helping mplayer’s configure out with some paths. I’m sure an install through fink would work just as well.

Jon, 14 Dec 2005

Interestingly, I now get:

/usr/bin/ld: warning multiple definitions of symbol _glPointParameteri
libGL.dylib(gll_api.o) definition of _glPointParameteri
/usr/X11R6/lib/libGL.dylib(dri_dispatch.o) definition of _glPointParameteri
/usr/bin/ld: warning multiple definitions of symbol _glPointParameteriv
libGL.dylib(gll_api.o) definition of _glPointParameteriv
/usr/X11R6/lib/libGL.dylib(dri_dispatch.o) definition of _glPointParameteriv

At the end of my compile process, but the binary is still generated (as can be seen from the output below..)

Dokuro:~/Development/mplayer-cvs-new/mplayer-src/main jon$ ./mplayer
MPlayer dev-CVS-051214-16:03-4.0.1 (C) 2000-2005 MPlayer Team

Is your ‘failed’ compile spitting out a binary despite giving the error?

Jon, 14 Dec 2005

I’m running into the very same problem, and mplayer binary is most definitely not being built… This is on an iMac G5 system. I’m using XCode 2.1, though - I’m downloading 2.2 now, although reading the comments it probably wouldn’t fix the problem.

Attila, 18 Dec 2005

Possibly of interest could be compiling mplayer with

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

That clears up all outstanding error messages on my setup, and should prevent some of the code that is causing these compilation failures from being built (these flags actually leave quartz & macosx vo drivers, which are the only two that really work well for display output on Mac OS X anyway..)

Jon, 21 Dec 2005

Worked great.. performance in command line version is much better the the osx port. Cheers =)

Abe, 04 Jan 2006

Audio is lagging behind the video.. is this just because my machine is slow.. G3/700/384. videos play fine in vlc… any suggestions? TIA

Abe, 04 Jan 2006

If you’re playing the file from a network mounted drive, copying it to a local drive can really help (I get delayed audio on a 1.67GHz PowerBook over WiFi if the bitrate is high enough). Alternatively (and more conveniently) you can pass -cache 20000 or something similarly big to cache enough of the file that the player doesn’t run out of data (mplayer’s docs suggest a value of 8096 should be fine, but I find that doesn’t really help..).

It may also be that the file is having problems playing due to the CPU scaling when not connected to mains power, but if VLC is working mplayer should have no problem playing the same files. Hope this helps in some way.

Jon, 04 Jan 2006

Thanks for these helpful tips for compiling mplayer. I’m used to the command line of mplayer from the windows side of things and didn’t much appreciate the gui in the official osx build (except for the secondary monitor fullscreen output: -vo macosx:device_id=2 thanks for pointing me to the command line option!).

Compiling went quite smooth but I also had to fiddle with the paths and use -font in combination with a truetype font to make the FreeType options work. I also tweaked the subtitle config you provided to my liking:


The subfont.ttf is luxisb.ttf copied over from /usr/X11R6/lib/X11/fonts/TTF/ to ~/.mplayer/

Adrian, 12 Jan 2006

Hey, Worked perfectly! If you could make an overall guide covering VC-1 and this into one, that would be brilliant. One issue; make install needs to be run as root, or with sudo, whether that affects the outcome, I’m not sure, but when you said “Once your binaries exist, make install them to use them system wide”, when I go sudo make install, it doesn’t work by simply typing mplayer. Thanks for a brilliant guide!

Banana, 22 Jan 2006

Keep getting:

/usr/bin/ld: Undefined symbols:
collect2: ld returned 1 exit status
make: *** [mplayer] Error 1 On x.4.4 and xcode 2.2, am i forgetting a library ?

jxl, 22 Jan 2006

jxl, Those messages were the outcome of a compilation error in the mplayer cvs build, which seems to have been fixed now (I encountered them myself several days ago). Obviously as the state of the cvs repository is unguaranteed, these kinds of things can happen, but generally most build failures seem to be fixed within a week or so.

For reference, I have just built an up to date copy of mplayer-cvs using xcode 2.2.1 and Mac OS X 10.4.4 without any trouble.

Dokuro:~/Development/mplayer-cvs-new/mplayer-src/main jon$ ./mplayer
MPlayer dev-CVS-060125-21:28-4.0.1 (C) 2000-2006 MPlayer Team

Jon, 25 Jan 2006

banana, mplayer installs itself into /usr/local (the default location for a lot of packages that build with source to install to). If your shell isn’t looking in that location for binaries then you wont be able to run mplayer without a full path.

To fix the problem, you can make your system look in /usr/local/bin by editing the file ~/.bashrc to add a line at the bottom like:

export PATH="$PATH:/usr/local/bin"

You can check if this is going to solve your problem before editing the file by just running that command in your terminal, then typing mplayer. It should run successfully, but putting it in the .bashrc file it’ll be automatically set for you on all of your new terminal instances.

Jon, 25 Jan 2006

SAWEET!!! This is so cool! (Yes, I’m an American. It’s the accent, right?) I’m no developer or UNIX geek by any means, but I do know how to follow directions and have some basic knowledge of the ugly underside of an OS. When I went from 10.3 to 10.4 my baby broke.

I had a script that used mplayer and lame to convert RealAudio files into MP3s. (Real into WAVs, WAVs into MP3s). Well, it broke when I made the OS jump. I couldn’t find ANYTHING on how to compile mplayer on 10.4. I was reduced to leaving my G3 500Mhz iBook on 10.3 to do these conversion instead of using my 1.25Ghz G4. Now I’m back baby! Thank you for this solution Jon.

By the way, I’ve been to the UK for the bast four summers on work trips and I LOVE it. Greetings to my cousins across the pond.

Corby, 27 Jan 2006

Still having troubles compiling , first I got problems with theora/theora.h not found. So I used the configure -disable-theora, which brought me to my old error but with a twist, it adds symbol _locale_charset used from dynamic library /sw/lib/libiconv.dylib(localcharset.o) not from earlier dynamic library /sw/lib/libintl.1.dylib(localcharset.lo)

So it’s using things from fink even though I don’t want it to, so question here is do you have fink installed? Or could you possibly post (or mail) your config.mak file (so i could see the differences between them) Thx for the reply

jxl, 28 Jan 2006

For people with the same problem, I have tried to build Mplayer with all the fink stuff disabled and it made no difference, just came back with the ld error. My next (poorly educated) guess is that it’s not Mplayers fault, it’s Apple’s. I’ve found references tot the same error and they suggest using g++ as the compiler (which MPlayer doesn’t like) but I think Apple has updated their linker ld with XCode 2.2.1 (as I’m using 2.2 & x.4.4). So they broke it with x.4.4 but fixed it with XCode 2.2.1. Pure guesswork.

jxl, 30 Jan 2006

I seem to be able to compile just fine, but I can’t play any files with the resulting mplayer binary. It doesn’t seem to have compiled in the macosx video out - the only options I have are null, mpegpes, yuv4mpeg, tga, pnm, md5sum. I configured with the following:

./configure -disable-gl -disable-x11

I checked out the 02-03-2006 build. Thanks,

Devin Lane, 04 Feb 2006

Jon says: Devin, the output at the end of ./configure should let you what video output drivers are going to be built. With the configure flags:

./configure --with-freetype-config=/usr/X11R6/bin/freetype-config

./configure reports the following

Video output: md5sum pnm png mpegpes(file) opengl xv x11 xover tga macosx quartz
Trying out the configure flags you posted resulted in
Video output: md5sum pnm png mpegpes(file) tga macosx quartz
at configure, and in the actual build (mplayer -vo help)
Available video output drivers:
        macosx  Mac OSX Core Video
        quartz  Mac OSX (Quartz) This is on a freshly checked out copy of mplayer-cvs (build version reports as `MPlayer dev-CVS-060204-20:33-4.0.1`) and a Powerbook G4 with OS X 10.4.4, XCode 2.2.1. If the above checks and a fresh check out from cvs (`cvs -z3 update -dPA` in your `main` directory checked out originally) doesn't solve your problems, knowing any major differences in your set-up to mine would be useful to see if there are any significant differences that could be causing your problem.

Jon, 04 Feb 2006

jxl, I do have fink installed, but this has varied randomly as I’ve moved around from darwinports to fink and a plain set of OS X command line tools. I do remember removing all of fink to try to solve build problems previously and I’ve found that it had very little effect. If you’re still interested I’ve put my config.mak file up.

Jon, 04 Feb 2006

Jon: Thanks for the reply. I had to configure with -enable-macosx before the macosx and quartz video outputs were included at compilation (they appeared under the disabled list with a normal configure). Thanks,

Devin Lane, 05 Feb 2006

I’ve followed these instructions down to the letter, it compiled with no errors and I installed it. But when I try to run mplayer in the Terminal it says the command is not found. Any ideas on what could cause it?

Eric, 09 Feb 2006

Eric, have you looked at some of the things I mentioned in post #16 about paths and /usr/local? I’m pretty sure that material might help you out.

Jon, 13 Feb 2006

Thanks for the helpful post. I was having a problem with the mplayer in darwinports on a real video stream I was trying to save. Using the CVS version I was able to save the video.

Raishad, 20 Feb 2006

I’m curious. I’m going to be getting a MacBook Pro soon. Will I be able to follow this procedure and still have it work, or is the mplayer code specific to PowerPC architecture? Will this work with the new Intel stuff? I have it working great in my eMac.

Corby, 21 Feb 2006

Any advice on compiling on Panther? I’ve got 10.3.9 with Xcode 1.5 and the November 2004 GCC updater for Xcode 1.5. I tried several things, even the Draconian

$ ./configure -disable-gl -disable-x11 -disable-macosx
-disable-gui -with-freetype-config=/usr/X11R6/bin/freetype-config

The result is littered with errors (80 of them), ending with:

In file included from ppc/dsputil_h264_altivec.c:37:
ppc/dsputil_h264_template_altivec.c: In function 'put_h264_qpel16_hv_lowpass_altivec':
ppc/dsputil_h264_template_altivec.c:429: error: incompatible types in initialization
In file included from ppc/dsputil_h264_altivec.c:57:
ppc/dsputil_h264_template_altivec.c: In function 'avg_h264_qpel16_hv_lowpass_altivec':
ppc/dsputil_h264_template_altivec.c:429: error: incompatible types in initialization
make[1]: *** [ppc/dsputil_h264_altivec.o] Error 1
make: *** [libavcodec/libavcodec.a] Error 2

The mplayer and mencoder executables that are embedded in the MPlayerOSX and MEncoderOSX packages work from the command line, but not very well (mencoder dies with a bus error most of the time).

I’m guessing this just isn’t possible on my setup (no, I can’t switch to 10.4 yet). All I really want to do is grab RealPlayer streams for my wife’s iPod, without resorting to kernel extensions and GUI programs like Audio Hijack, WireTap, or iRecordMusic, which can’t be run by cron.

Thanks for any help or advice,

JonL, 27 Feb 2006

Anybody running into errors trying to compile on 10.4.5? I was previously able to use these exact instructions to compile mplayer on a 10.4.4 machine and then I had to switch to a new powerbook that had 10.4.5 and my compiled binary didn’t work anymore (though it worked on multiple other Macs and still does that are 10.4.4). I try to compile on 10.4.5 and I get an error during Make (I’m sorry I don’t have the exact text to post but it ended with: Error 1.

Using XCode 2.2.1 on 10.4.5. Would not having X11 make any real difference? Is there some way I can get a precompiled binary that is confirmed to run on 10.4.5? I mainly ask because current public binaries handle recent MKV/h264 files terribly but recent cvs builds were working just perfectly on my old Mac. Sorry if some of this is very newbish…

Insomnic, 06 Mar 2006

Hello, I’m also trying to compile mplayer cvs on 10.4.5 with Xcode 2.2.1 and I’m getting this error:

/usr/bin/ld: Undefined symbols:
collect2: ld returned 1 exit status
make: *** [mplayer] Error 1

Any clues? Thanks.

Marc, 06 Mar 2006

I’m having no problems building recent CVS here. Just a make clean then make. To answer Insomnic, having X11 might be important and ensuring you have all relevant SDK and developer kits installed with your Xcode may be worthwhile.

Dokuro:~ jon$ mplayer
MPlayer dev-CVS-060306-15:07-4.0.1 (C) 2000-2006 MPlayer Team

I’m running 10.4.5 on a Powerbook G4 with Xcode 2.2.1

Dokuro:~ jon$ gcc --version
powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5250)
Dokuro:~ jon$ uname -a
Darwin Dokuro.local 8.5.0 Darwin Kernel Version 8.5.0:
Sun Jan 22 10:38:46 PST 2006; root:xnu-792.6.61.obj~1/RELEASE_PPC
Power Macintosh powerpc

Jon, 06 Mar 2006

Thanks. If it works for you it’s gotta work for me then. I’ll keep chugging away at it. Thanks for the suggestions (and this comment thread in general).

Insomnic, 06 Mar 2006

I’ve had the same compilation problem giving me the error message Undefined symbols:__Unwind_Resume… I solved this issue by using apple gcc 4.0 and not 4.0.1… gcc 4.0.1 have been installed with XCode 2.2. I hope this can help you.

Dilaroga, 09 Mar 2006

Hello i acquired this new intel minimac 1.5 Ghz smth. mplayer osx is way too slow to watch any divx with it and vlc is also damn slow so i had a thought i should compile mplayer myself. been only compiling stuff on unix a like systems and not guis so i found your page where u have managed to compile this thing without the odd gui. I did exactly like u had on this page… and got this:

-c -o i386/fdct_mmx.o i386/fdct_mmx.c
{standard input}:unknown:file contains unmatched .macro and
.endmacro for: FDCT_ROW_SSE2_H1it
make[1]: *** [i386/fdct_mmx.o] Error 1
make: *** [libavcodec/libavcodec.a] Error 2
my gcc and other crappage are:
i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5250)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
Darwin paha-juuris-computer.local 8.6.1 Darwin Kernel Version 8.6.1
Tue Mar 7 16:55:45 PST 2006; root:xnu-792.9.22.obj~1/RELEASE_I386
i386 i386

and btw if anyone knows how to change that paha-juuris-computer.local i would appreciate it annoys me.

Len, 28 Apr 2006

Len, I too cannot compile this on my Intel MacBook Pro. I posted about this in advance of my purchase (back in post 27). If this can be solved I’d appreciate it.

As to your paha-juuris-computer.local question, try this. Go to your System Preferences, click on Sharing and you will see Computer Name and it probably says paha-juuris. Replace that with anything you like. That’s what you will see in Terminal prompts and it is also what other computers on a network would see to identify your computer.

Corby, 28 Apr 2006

I applied this patch and it compiles.

Sylvain, 12 May 2006

links for 2006-11-06

Trackback, 06 Nov 2006

Yeah… I’ve had a similar problem with the most recent SVN on a core duo macbook I recently laid hands on.

cc -c -I.. -Wdeclaration-after-statement -O4 -march=pentium-m
-mtune=pentium-m -pipe -ffast-math -fomit-frame-pointer
-mdynamic-no-pic -falign-loops=16 -DSYS_DARWIN -DCONFIG_DARWIN
-shared-libgcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-I/usr/X11R6/include -fomit-frame-pointer -o decode_i586.o
cc -c -I.. -Wdeclaration-after-statement -O4 -march=pentium-m
-mtune=pentium-m -pipe -ffast-math -fomit-frame-pointer
-mdynamic-no-pic -falign-loops=16 -DSYS_DARWIN -DCONFIG_DARWIN
-shared-libgcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-I/usr/X11R6/include -o decode_MMX.o decode_MMX.c
{standard input}:91:Unknown pseudo-op: .balign
{standard input}:91:Rest of line ignored. 1st junk character
valued 49 (1).
{standard input}:163:Unknown pseudo-op: .balign
{standard input}:163:Rest of line ignored. 1st junk character
valued 49 (1).
make[1]: *** [decode_MMX.o] Error 1
make: *** [mp3lib/libMP3.a] Error 2

Alexander Wehr, 18 Nov 2006