[Wine] Mac OS X From Source

Ryan Woodsmall rwoodsmall at mac.com
Fri Apr 30 21:32:50 CDT 2010

>It's more beneficial to me to learn through mistakes and end up with a better understanding and being able to debug problems as they come up, than to use a pre-built or scripted solution.  That said I downloaded the lated git of Wine, and ran the configure the first time, I looked up the dependancies and downloaded the ones I wanted (in particular libpng, libjpeg, and libgnutls).

Excellent - it is beneficial to know the build process (and that of dependencies).

>After that I googled for several hours to try and find out to force compile into 32 bit more, and found minor scraps of information similar to the flags (environment variables) for the wine install.  I tried several configurations of those flags, and finally I managed to change the configure log for libjpeg from x86_64-apple-darwin10.3.0 to i386-apple-darwin10.3.0, and compiled/installed successfully, I think!
>The problem is I have no idea how to check the version/architexture of a lib file, and yeah google wasn't very helpful there either.  So I ran the wine configure again, and to my dismay still throwing up its hands at a missing supported libjpeg architexture.

You can check what architectures a library supports using the "file" command from a terminal.  For example, the libxml2 library supports 32-bit Intel and PowerPC and 64-bit Intel platforms:

rbwmbp:~ ryan.woodsmall$ file /usr/lib/libxml2.dylib 
/usr/lib/libxml2.dylib: Mach-O universal binary with 3 architectures
/usr/lib/libxml2.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
/usr/lib/libxml2.dylib (for architecture i386):	Mach-O dynamically linked shared library i386
/usr/lib/libxml2.dylib (for architecture ppc7400):	Mach-O dynamically linked shared library ppc

How comfortable are you in a terminal?  With a compiler, linker and environment variables?  Have you looked over and fully comprehended the OS X build page?


You need to compile *all* required libraries with, at a minimum, the CFLAGS setting to build as 32-bit code.  You'll need to make sure that Wine can find the headers and libraries by modifying/appending to your include paths (adding CPPFLAGS -I/path/to/incdir for each directory) and your library path (set using LDFLAGS -L/path/to/libdir additions).  You'll need to set DYLD_FALLBACK_LIBRARY_PATH for running Wine after you've built it; this should reflect your LDFLAGS setting so libraries can be found at runtime.


I cooked up a script to compile Wine from source, including all possible (I think, anyway) dependencies relevant on OS X:


You don't have to use this, of course, but the source is there and open (LGPL'ed) if you're so inclined to look under the covers of how you can force packages to build as 32-bit from source:


If you're building dependent packages by hand, from source, you'll need to make sure CFLAGS, CPPFLAGS, LDFLAGS, etc., all remain set for *each* package.  Again, Wine's configure program will need to know how to find the headers and libraries you generated by running "./configure && make && make install" - if you've specified an install path with configure's "--prefix=/path/to/wherever" option, you'll need to make sure Wine's looking in the proper location in your filesystem.

Using MacPorts, you can force 32-bit compiler output by setting a couple of config file options:

- In /opt/local/etc/macports/macports.conf
    Uncomment and set "build_arch i386"
    Remove 64-bit code building from the universal_archs directive by changing the line to "universal_archs i386"
- And/or in /opt/local/etc/macports/variants.conf or ~/.macports/macports.conf
    Set "+universal"

There are a lot of gotchas to building from source on any platforms, but OS X is different enough that it's a bit painful to explain top to bottom in an easy manner.  Good luck, and let us know how you progress.

More information about the wine-users mailing list