View Single Post
Old 2008-07-30, 08:47   Link #30
anime_layer
Senior Member
*Graphic Designer
 
 
Join Date: Feb 2003
Location: Zürich, Switzerland
Send a message via ICQ to anime_layer
I've been trying to get my head around a redistributable mplayer build and I think I've made some progress.

First I've tried to build mplayer statically (--enable-static) but that kept failing. I've already heard that Apple deliberately crippled the osx build environment but I couldn't link it to static executables. They excluded the static build of the C runtime library so any attempt to build a static executable will fail. Though, if you really want to build a static executable you can to so by compiling a static version of that library yourself from the darwin sources.

Anyway, that the configure script failed with the error that it couldn't find inttypes.h didn't help much in finding the problem. When I finally figured out that my approach was flawed I could finally continue in the search of the right one.

Turns out that's just linking the custom libraries statically. But first you should compile against the osx SDK. I took the build script from the mplayer osx project as a starting point and played with the cflags and ldflags until it finally compiled (happy stories about gcc choking on the assembler code and configure picking up the newer fontconfig while the linker wants to link the older one from osx).

Also, libraries compiled under Leopard won't work with Tiger. There are some POSIX changes in Leopard that are not compatible with Tiger. If you want backward compatibility, you have to specifically compile them with the old POSIX functions.

Well then, to the static linking. Turns out osx will always prefer shared libraries but through stubborn digging I found the -search_paths_first option (actually -Wl,-search_paths_first if you add it as a ldflag). It makes the linker use the static libraries from a directory if there are no shared ones and not search all other directories for a shared one even if it already found the static library.

Don't know if that's the best approach but I ended up creating /sta/local/lib and coping all *.a files from /opt/local/lib to that folder and added it in front of all other search directories to the ldflags.

Turns out macports doesn't do a static version of liblzo2 so I had to make one myself (rather easy, but still...). Also, libfontconfig relies on libexpat but the linker apparently didn't know that and I had to include -lexpat to the extralibs.

Finally, otool -L only showed shared system libraries and the binary works on my friends laptop without macports installed!

Here's a test version of the gui with the binary included. I would be interested if it's working for everyone.
http://files.rubbishchute.net/animes...-rev4-test.dmg
Oh, and if you've skipped the text above, this is Leopard only and intel only. Compiling for Tiger and as an universal binary is still some pitas away.

@Ryoujin
Seems like your mplayer was built without fontconfig. Go back to your build directory and rerun ./configure. Check the output and see if it says fontconfig ... yes or no.
__________________
MPlayer OSX Extended (en) | nimmermehr (de) | sttz (de) | last.fm
Life is a game whose first rule is: This is not a game, this is dead serious.
anime_layer is offline