MacOSX/Building

There is plenty of choice. You can use a package management system (MacPorts or Fink) or roll your own binary.

/!\ Note that since Xcode 3.x (as distributed with Leopard), a bug in the MacOS linker causes all 16 bit applications (incl. installers) to crash. If you have a Tiger system, use Xcode 2.x from your DVD. If you are a developer, you can obtain Xcode 2.x from Apple's Developer Connection (ADC). Or you may patch the Xcode 3.x linker source code per the instructions given in bug #14920. Otherwise use ./configure --disable-win16

/!\ As of Mac OS X 10.6 (Snow Leopard) the compiler compiles to 64-bit by default. This causes problems when attempting to compile the stable (1.0.1) release of Wine, but the newer (unstable) builds deal with this issue and is a lot easier to compile under Snow Leopard.

Build Wine, the lightweight way

Build with minimal fuss

In order to build/run Wine, you will need to have the following prerequisites installed on your Mac:

  • X11/XQuartz - If you are running Mac OS X 10.5 (Leopard) or newer, you can install X11 from your Mac OS X installation DVD by running the optional installs package. If you are running a version prior to Mac OS X 10.5, you will need to download and install XQuartz.

  • Xcode - Xcode is included on your Mac OS X installation DVD in the 'Optional Installs' folder. Either install the version that shipped with your operating system's DVD, or download the latest version from the Apple web site. If you do not wish to install the full Xcode suite, locate and install at least the GCC, CoreAudioSDK and X11SDK packages...

Download the Wine source. You need not install git (not part of Xcode) if you use a source tarball from ibiblio.org. {i} However, we do recommend using git with Wine as you will be asked to perform RegressionTesting if you have an application that used to work and stopped working in a newer version.

If you are running Mac OS X 10.6 (Snow Leopard), you will need to explicitly set the path to your X11 development headers/libraries prior to running the configure script and to tell gcc to generate 32bit code with the following export commands:

export CFLAGS="-arch i386 -m32"
export CXXFLAGS="$CFLAGS"
export CPPFLAGS="-I/usr/X11/include"
export LDFLAGS="-L/usr/X11/lib"

You now have everything you need to build the Wine source code. Like thousands of other open source software packages, you should now run ./configure and make to build the code:

./configure --verbose
make depend && make

(!) Run ./wine winecfg and visit the audio tab to enable audio.

Build with all possible libraries

The above ./configure --verbose reports half a dozen missing libraries.

configure: libhal/libdbus 32-bit development files not found, no dynamic device support.
configure: libgnutls 32-bit development files not found, no schannel support.
configure: libsane 32-bit development files not found, scanners won't be supported.
configure: libgphoto2 32-bit development files not found, digital cameras won't be supported.
configure: liblcms 32-bit development files not found, Color Management won't be supported.
configure: libcapi20 32-bit development files not found, ISDN won't be supported.
configure: WARNING: libjpeg 32-bit development files not found, JPEG won't be supported.

You can live without them, depending on your needs. If you need them (e.g. for printing, color management, or networking), consider using a package management system like Fink or MacPorts (see below). They ease installing and updating dozens or hundreds of libraries and packages. However, in order to build Wine, <:( both Fink and MacPorts install many more packages (e.g. a complete X server among others?).

Anyway, is hal needed on Mac OS? It has its own device management.

<!> A missing JPEG library will cause several test failures, e.g. in olepicture.ok and gdiplus:image.ok

Installing Wine into /usr/local

After compiling the Wine source code, you can run Wine directly from the source code directory using the 'wine' shell script that is created. If you want to be able to run 'wine' from any directory, you can choose to install the necessary files into '/usr/local' by running:

make install

{i} You can later remove the files by running 'make uninstall' from the directory containing the Wine source code

Build Wine, the scripted way

A scripted method for building and installing Wine on Mac OS X has been put together in order to simplify installation from source. A number of the additional packages described below are built as part of the Wine installation. This project is - as usual - not officially affiliated with Wine, and has its own issue tracker. If you encounter problems with the build script, please do not send a message to the Wine user or developer mailing lists; instead, access the project directly at http://code.google.com/p/osxwinebuilder/ and file a bug report with the developer there.

This method installs a Wine built from source code into the the user's home directory into the ~/wine directory hierarchy. As such, no system-level directories should be touched, nor should administrator access be needed.

Wine hints and tips for source builds

When installing Wine from source on Mac OS X, a user may need to set a few environment variables in their terminal/shell session.

Depending on your system configuration you may have to set the DYLD_FALLBACK_LIBRARY_PATH environment variable to tell Wine where to find the X11 OpenGL library files along with its own library files. Therefore, in practice, running Wine on Mac OS X might require a command such as the following:

DYLD_FALLBACK_LIBRARY_PATH="/usr/X11/lib:/usr/lib" wine program_name.exe 

A patch to insert DYLD_FALLBACK_LIBRARY_PATH into tools/winewrapper was rejected 2009-07.

MacPorts and Fink may have other workarounds for the DYLD_FALLBACK_LIBRARY_PATH issue.

Build Wine, the Fink way

The Fink package description shows which release is current in Fink's package management. If this is not the most recent Wine release, you should nevertheless be able to apply this description to build the most recent release yourself.

Build Wine, the MacPorts way

The MacPorts wine-devel package description shows which release is current in MacPorts' package management. If this does not correspond to the most recent Wine release, you should still be able to apply this description to build the most recent release yourself.

{i} You should install wine-devel, which tracks the "unstable" branch, because a) the stable one is rapidly outdated and b) developers prefer you report bugs about their most current release than the one produced month ago. For several months AppDB did not let you submit test results about the stable branch because it was considered outdated and thus uninteresting (for developers).

Note that as of 2009-06, Valgrind is available in Fink, not yet in MacPorts.

How to build the Mac OS X Package from scratch

This section needs to be filled up for WineHQ.

Additional packages you might want

Both MacPorts and Fink will download all of these (and many more) and not let you build without them.

* Fontforge: http://fontforge.sourceforge.net/

* FreeType: http://freetype.org/

* LibJPEG: http://www.ijg.org/

* LibTIFF: http://www.libtiff.org/

* LibXML2: http://xmlsoft.org/

* LibXSLT: http://xmlsoft.org/xslt/

Add --enable-maintainer-mode or --verbose to your ./configure line to see a full list of packages that Mac OS X does not provide but Wine may possibly need.

MacOSX/Building (last edited 2010-01-25 23:43:51 by rwoodsmall)