Welcome, Guest! Log In | Create Account

Snow Leopard

64-bit Compilation

As noted on the Build Page, Snow Leopard if left to itself will build 64-bit binaries. The most recent revision of jhbuildrc has been tested with this up through meta-gtk-osx-core, and it seems to work fine. However, Pango was updated in July 2009 to compile for 64-bit in a way that precludes building for Tiger, so the revision in the stable moduleset is held back for Tiger compatiblity. Consequently, as noted on the Build Page, you'll have to use the unstable moduleset until that gets resolved. Also note that ige-mac-integration uses Carbon, which doesn't support 64-bit compilation, so that won't build; Gimp also uses similar code, so that will have to be patched away, and PyGtk also depends on ige-mac-integration.

Building

So, how do you manage this? It's pretty easy. Make sure that you have the latest modulesets and jhbuildrc by running

gtk-osx-build-setup.sh

again. Then include the following in your .jhbuildrc-custom:

setup_sdk("10.6", "10.6", ["i386"])

That will build 32-bit Intel binaries using MacOSX10.6.sdk with MACOSX_DEPLOYMENT_TARGET=10.6. Python programmers will notice that the architecture argument is in a list, but don't call it directly with more than one architecture. There's a function for building universal libraries, setup_universal_build(), and one for cross-compiling PPC libraries on an Intel machine, but gtk+ doesn't cooperate, crashing when it tries to load icons. You can safely pass either "i386" or "x86_64" if you're building on an Intel box, or "ppc" or "ppc64" if on a PPC machine. Setup_sdk() will take care of all sorts of details like skipping ige-mac-integration for a 64-bit build.

PyGtk

PyGtk users and developers should note that Snow Leopard provides a bunch of pythons, with the default being 2.6. On a 64-bit processor (core2duo or xeon), it defaults to 64 bit, and unless you've managed to get PyGtk built for 64 bits, it won't work. Fortunately, you can easily get python to run in 32-bit mode by default: defaults write com.apple.versioner.python Prefer-32-Bit -bool yes or export VERSIONER_PYTHON_PREFER_32_BIT=yes. jhbuildrc already sets the environment variable when appropriate, so if you work in a jhbuild shell, you're covered. See man python for more details on this, or for how to switch between the installed Python versions.

Snow Leopard's pythons are all build with MACOSX_DEPLOYMENT_TARGET=10.6, so if you want to support older OSX versions (via setup_sdk(), of course), you'll need to build python from bootstrap -- but that doesn't work on Snow Leopard unless you fall back to gcc4.0 (which you can do, of course). The problem with the Apple pythons, which configure hides, is that the Apple-provided pythons encounter the MACOSX_DEPLOYMENT_TARGET difference and quit, so the include directory doesn't get set and gcc can't find Python.h -- which is the error that configure reports.

I've filed a bug with jhbuild to get them to use a newer python; in the meantime, add

_gtk_osx_use_jhbuild_python=True
append_autogenargs("python", "--with-universal-archs=32-bit --enable-universalsdk=/Developer/SDKs/MacOSX10.5.sdk")
branches["python"] = "http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tar.bz2"

to your jhbuildrc-custom and do

jhbuild bootstrap --ignore-system

It will whine about the size not matching, so open a shell, untar it by hand, quit the shell and tell jhbuild to ignore the error and continue to configure.

Note the autogenargs for python. Python's configure sets its own CFLAGS, so in order to get something other than an x86_64 build on SL, we have to tell it to build universal. "32-bit" builds ppc and i386; "3-way" builds ppc, i386, and x86_64. Don't build x86_64 unless you're also building everything else x86_64, or it won't run on Snow Leopard without specifying "arch -i386" in front of any command you run. This python lacks Apple's "versioner" magic, so setting that in the environment or in defaults won't do anything for us. If you're building against 10.4u.sdk, you don't need the enable-universalsdk argument, as that's the default in Python. If you're building against another SDK (even if it's 10.6 or the installed default) you need this (obviously set it to whatever you're actually using. If you're using the installed libraries, set it to "/". See Python-2.6.4/Mac/README for more details about building Python for Macs.

More

If you have more tips or workarounds, feel free to edit this page (you'll need to log in to Sourceforge first).