What

This page summarizes my experience on hacking the wine Makefiles to build with GNU GCC 4.5 on Mac.

Why

Apple's version of GCC supports extensions for CF_FORMAT_FUNCTION() and CF_FORMAT_ARGUMENT() which are not supported by the standard GNU GCC compilers. To prevent the core foundation classes from failing to compile on non-Apple GCC's the functions are conditionally included via the following logic.

/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h:156
#if defined(__GNUC__) && (__GNUC__*10+__GNUC_MINOR__ >= 42) && !defined(__INTEL_COMPILER) && (TARGET_OS_MAC || TARGET_OS_EMBEDDED)

Unfortunately this logic leaves a bit to be desired as any version of GNU GCC >= 4.2 will attempt to include the functions. Doing so will prevent the core foundation headers from compiling resulting in a failure to build. This causes build failures in wine's crypt32, kernel32, and ntdll.

How

We notice in the above logic that by mimicking the Intel compiler will avoid the functions from being defined and allow the build to succeed. I manually made the modifications below in order to allow compilation to succeed on my MacBook running 10.6.3

dlls/crypt32/Makefile:EXTRADEFS = -D_CRYPT32_ -D__INTEL_COMPILER
dlls/kernel32/Makefile:EXTRADEFS = -D_KERNEL32_ -D__INTEL_COMPILER
dlls/ntdll/Makefile:EXTRADEFS = -D_NTSYSTEM_ -D__INTEL_COMPILER

The -arch option will fail to compile if set in CFLAGS so drop it and use the following to build

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

Problems

No audio. I've had some success using the Jack plugin on MacOSX to get audio working. However it appears the configure script is broken on Mac OSX when using the Jack Framework packages. Still more debugging to do to enable this but its not a very high priority for me.

checking AudioToolbox/AudioConverter.h usability... yes
checking AudioToolbox/AudioConverter.h presence... yes
checking for AudioToolbox/AudioConverter.h... yes
checking AudioToolbox/AudioFile.h usability... no
checking AudioToolbox/AudioFile.h presence... yes
configure: WARNING: AudioToolbox/AudioFile.h: present but cannot be compiled
configure: WARNING: AudioToolbox/AudioFile.h:     check for missing prerequisite headers?
configure: WARNING: AudioToolbox/AudioFile.h: see the Autoconf documentation
configure: WARNING: AudioToolbox/AudioFile.h:     section "Present But Cannot Be Compiled"
configure: WARNING: AudioToolbox/AudioFile.h: proceeding with the compiler's result
configure: WARNING:     ## ------------------------------------ ##
configure: WARNING:     ## Report this to wine-devel@winehq.org ##
configure: WARNING:     ## ------------------------------------ ##
checking for AudioToolbox/AudioFile.h... no
checking AudioToolbox/AudioFileStream.h usability... no
checking AudioToolbox/AudioFileStream.h presence... yes
configure: WARNING: AudioToolbox/AudioFileStream.h: present but cannot be compiled
configure: WARNING: AudioToolbox/AudioFileStream.h:     check for missing prerequisite headers?
configure: WARNING: AudioToolbox/AudioFileStream.h: see the Autoconf documentation
configure: WARNING: AudioToolbox/AudioFileStream.h:     section "Present But Cannot Be Compiled"
configure: WARNING: AudioToolbox/AudioFileStream.h: proceeding with the compiler's result
configure: WARNING:     ## ------------------------------------ ##
configure: WARNING:     ## Report this to wine-devel@winehq.org ##
configure: WARNING:     ## ------------------------------------ ##
checking for AudioToolbox/AudioFileStream.h... no
checking AudioUnit/AudioUnit.h usability... no
checking AudioUnit/AudioUnit.h presence... yes
configure: WARNING: AudioUnit/AudioUnit.h: present but cannot be compiled
configure: WARNING: AudioUnit/AudioUnit.h:     check for missing prerequisite headers?
configure: WARNING: AudioUnit/AudioUnit.h: see the Autoconf documentation
configure: WARNING: AudioUnit/AudioUnit.h:     section "Present But Cannot Be Compiled"
configure: WARNING: AudioUnit/AudioUnit.h: proceeding with the compiler's result
configure: WARNING:     ## ------------------------------------ ##
configure: WARNING:     ## Report this to wine-devel@winehq.org ##
configure: WARNING:     ## ------------------------------------ ##
checking for AudioUnit/AudioUnit.h... no
checking Carbon/Carbon.h usability... no
checking Carbon/Carbon.h presence... yes
configure: WARNING: Carbon/Carbon.h: present but cannot be compiled
configure: WARNING: Carbon/Carbon.h:     check for missing prerequisite headers?
configure: WARNING: Carbon/Carbon.h: see the Autoconf documentation
configure: WARNING: Carbon/Carbon.h:     section "Present But Cannot Be Compiled"
configure: WARNING: Carbon/Carbon.h: proceeding with the compiler's result
configure: WARNING:     ## ------------------------------------ ##
configure: WARNING:     ## Report this to wine-devel@winehq.org ##
configure: WARNING:     ## ------------------------------------ ##
checking for Carbon/Carbon.h... no
checking CoreAudio/CoreAudio.h usability... no
checking CoreAudio/CoreAudio.h presence... yes
configure: WARNING: CoreAudio/CoreAudio.h: present but cannot be compiled
configure: WARNING: CoreAudio/CoreAudio.h:     check for missing prerequisite headers?
configure: WARNING: CoreAudio/CoreAudio.h: see the Autoconf documentation
configure: WARNING: CoreAudio/CoreAudio.h:     section "Present But Cannot Be Compiled"
configure: WARNING: CoreAudio/CoreAudio.h: proceeding with the compiler's result
configure: WARNING:     ## ------------------------------------ ##
configure: WARNING:     ## Report this to wine-devel@winehq.org ##
configure: WARNING:     ## ------------------------------------ ##
checking for CoreAudio/CoreAudio.h... no
checking DiskArbitration/DiskArbitration.h usability... no
checking DiskArbitration/DiskArbitration.h presence... yes
configure: WARNING: DiskArbitration/DiskArbitration.h: present but cannot be compiled
configure: WARNING: DiskArbitration/DiskArbitration.h:     check for missing prerequisite headers?
configure: WARNING: DiskArbitration/DiskArbitration.h: see the Autoconf documentation
configure: WARNING: DiskArbitration/DiskArbitration.h:     section "Present But Cannot Be Compiled"
configure: WARNING: DiskArbitration/DiskArbitration.h: proceeding with the compiler's result
configure: WARNING:     ## ------------------------------------ ##
configure: WARNING:     ## Report this to wine-devel@winehq.org ##
configure: WARNING:     ## ------------------------------------ ##
checking for DiskArbitration/DiskArbitration.h... no
checking IOKit/IOKitLib.h usability... yes
checking IOKit/IOKitLib.h presence... yes
checking for IOKit/IOKitLib.h... yes
checking IOKit/hid/IOHIDLib.h usability... no
checking IOKit/hid/IOHIDLib.h presence... yes
configure: WARNING: IOKit/hid/IOHIDLib.h: present but cannot be compiled
configure: WARNING: IOKit/hid/IOHIDLib.h:     check for missing prerequisite headers?
configure: WARNING: IOKit/hid/IOHIDLib.h: see the Autoconf documentation
configure: WARNING: IOKit/hid/IOHIDLib.h:     section "Present But Cannot Be Compiled"
configure: WARNING: IOKit/hid/IOHIDLib.h: proceeding with the compiler's result
configure: WARNING:     ## ------------------------------------ ##
configure: WARNING:     ## Report this to wine-devel@winehq.org ##
configure: WARNING:     ## ------------------------------------ ##
checking for IOKit/hid/IOHIDLib.h... no
checking OpenAL/al.h usability... yes
checking OpenAL/al.h presence... yes

...

configure: WARNING: No sound system was found. Windows applications will be silent.

MacOSX/Building/GCC 4 5 (last edited 2010-08-30 09:08:23 by EricMolitor)