Building Wine for Snow Leopard

I’m experimenting with Wine for Mac, and one thing I have noticed is that it is a pain to compile from source. In fact, that is the only way you can get Wine for Mac as there are no prebuilt binaries. For starters, you need to compile libraries that Wine depends on, which isn’t too bad with the help of MacPorts, but it gets a little complicated with Snow Leopard. Everything compiled via MacPorts is 64-bit on Snow Leopard, and Wine currently only compiles in 32-bit. To solve this, add the “+universal” variant at the end of all the packages you install (i.e. “sudo port install fontconfig +universal”). In some cases, a package will not build in 32-bit mode (in particular the mpg123 library). I was more or less able to get Wine working following the steps outlined on the Wine wiki: http://wiki.winehq.org/MacOSX/Building, but programs I ran on it didn’t look that great. For whatever reason, I was missing xrender, which I think attributed to applications looking bad. I tried installing it with MacPorts, but then I had two versions of X11 on my system, which was causing conflicts when I tried compiling Wine. No good. Each person who compiles Wine has the potential to have different dependencies, which may lead to different behaviors when running Wine. For instance, when I was running Steam, none of the buttons were rounded, and checkboxes weren’t showing up. I almost reported this as a Mac related bug, when the cause was me missing a library somewhere.

What I came up with as a potential solution to this problem involves a program called WineBottler. It is probably the closest thing there is to a distributable binary of Wine, and works great out of the box. This application confirmed my theory that I was missing a library for running Steam. WineBottler had all the libraries to make Wine run well, but it didn’t have the latest version. What I ended up doing was downloading the latest source using git, configuring the build and linking to those libraries included with WineBottler, and installing the newer build over the binaries originally shipped with WineBottler.

  1. Download the latest version of WineBottler and install it.
  2. Start out by getting the Wine source outlined here: http://wiki.winehq.org/GitWine
  3. If you’re on Snow Leopard, run the following commands:
    $ export CFLAGS="-arch i386 -m32";
    $ export CXXFLAGS="$CFLAGS"
  4. Set the CPPFLAGS environment variable:
    $ export CPPFLAGS="-I/usr/X11/include -I/Applications/Wine.app/Contents/Resources/include"
  5. Set the LDFLAGS environment variable:
    $ export LDFLAGS="-L/usr/X11/lib -L/Applications/Wine.app/Contents/Resources/lib"
  6. Configure Wine:
    $ ./configure --prefix=/Applications/Wine.app/Contents/Resources
  7. Build Wine:
    $ make depend && make && make install

Referencing the already compiled libraries from Wine.app allow us to build newer versions of Wine without having to worry about having all the correct libraries. Setting the prefix when we run ./configure automatically copies all the newly built binaries over to Wine.app. So now when I open the Wine config for Steam, I now have the latest version of Wine (it was originally 1.1.34):

One potential downside to this is that you may not be able to debug Wine with this setup. I know there is an option in WineBottler to output errors to a log file in ~/Library/Logs/Wine.log, but I’m not sure how verbose it is. And you can’t run “make test” without setting DYLD_FALLBACK_LIBRARY_PATH. I’ve tried doing both in the command line without success thus far.

One direction I hope Wine starts moving towards is removing these dependencies in favor of libraries that are already included in OS X. This would make creating prebuilt binaries much easier, and open Wine up to those who are less technically inclined. I think the Wine maintainers recognize that to some extent, and have listed implementing a Quartz Driver a priority for Wine’s 1.2 release. I personally don’t know what Quartz does/doesn’t allow, but it is conceivable to remove x11 and freetype as required libraries because TrueType rendering is natively supported on the Mac (Apple created it). As I learn more about Wine, I will try and post more information that new developers might find useful.

5 thoughts on “Building Wine for Snow Leopard

  1. Hey great breakdown here, you’re very knowledgeable! I’m having the worst trouble trying to compile any programs using the latest rev of winbottler which uses wine 1.1.35. The issue is constant across multiple machines having to do with fontconfig errors. Honestly, I just want IE6 to work, and work well and it’s failing.

    If you have 2 minutes I was wondering if you could offer some thought as to a fix? I’m not sure, but I believe an upgrade to snow leopard and then getting the latest version of X11 might be the fix (I got it to work on an iMac snow leopard, but I’m not positive that was the fix) but I don’t have a very solid window/linux background. What do you think? I’ve already tried to contact the WineBottler developer without avail. Is there a way to manually install whatever it needs for fontconfig?

  2. If you’re looking for updated versions of X11, you can find that by Googling “Xquartz” (the latest release candidate can be found here: http://static.macosforge.org/xquartz/downloads/SL/XQuartz-2.5.0_rc1.dmg). If you use MacPorts, you should be able to compile fontconfig with no problem (be sure to use +universal to compile 32-bit libraries as well). Beyond that, I can’t really say what’s causing it to not work without trying it out myself. Another thing to look into is winetricks (http://wiki.winehq.org/winetricks), which will install a lot of things for you in wine (ie6 is among them).

  3. Looks like you have a lo of experience installing this in Snow Leopard. Do you have any insight on whether this will also hold for Lion?

  4. Hey,

    Thanks for the info!

    Do you have any idea of the best way to configure macports/wine/xquartz to support wacom tablet pressure using OSX Lion?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>