Success Python 2.6.4 64-bit on Leopard with Tkinter!
OK I admit it.. I haven’t updated to Snow Leopard yet.. But I really wanted to get python 2.6.4 to behave in 64 bit with tkinter and there are a lot of posts out there which show this is apparently a problem. I wanted to solve it.
OK I admit it.. I haven’t updated to Snow Leopard yet.. But I really wanted to get python 2.6.4 to behave in 64 bit with tkinter and there are a lot of posts out there which show this is apparently a problem. I wanted to solve it.
Well as it turns out in reading many of the posts the problem is really Tk. By default Tk wants to build with it’s own version of X11 Libs which is rather dated and will show up as unable to build a 64-bit version of Python..
In other words if you simply pull python 2.6.4 and try to run this:
./configure --enable-framework MACOSX_DEPLOYMENT_TARGET=10.5 --with-universal-archs=intel --enable-universalsdk=/ makeYou should that tkinter fails to build.
That’s because Tk was built not for 64 bit. A quick look shows this is in fact the case..
> file /System/Library/Frameworks/Tk.framework/Versions/8.4/Tk /System/Library/Frameworks/Tk.framework/Versions/8.4/Tk: Mach-O universal binary with 2 architectures /System/Library/Frameworks/Tk.framework/Versions/8.4/Tk (for architecture i386): Mach-O dynamically linked shared library i386 /System/Library/Frameworks/Tk.framework/Versions/8.4/Tk (for architecture ppc7400): Mach-O dynamically linked shared library ppcOK So that explains why. Now here’s how you fix it.. Note: I’m only concerned about intel (sorry). I’m also assuming you don’t already have a new version of Tcl/Tk built Requirements: Building Tcl/Tk
export MACOSX_DEPLOYMENT_TARGET=10.5 export CFLAGS="-arch i386 -arch x86_64" export LDFLAGS="-Wall -arch i386 -arch x86_64" tar zxpvf tcl8.5.8-src.tar.gz cd tcl8.5.8/unix ./configure --enable-framework --enable-64bit --enable-threads make sudo make installCouple Notes:
- Yes the “unix” tree not the “macos” tree. It won’t work (especially true for Tk)
- Yes the CFLAGS and LDFLAGS are important - it won’t build 64-bit without it.
- You verify this by typing
file tclshand check for 64-bit..
export MACOSX_DEPLOYMENT_TARGET=10.5 export CFLAGS="-arch i386 -arch x86_64" export LDFLAGS="-Wall -arch i386 -arch x86_64" tar zxpvf tk8.5.8-src.tar.gz cd tcl8.5.8/unix ./configure --enable-framework --enable-64bit --enable-threads --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib make sudo make installCouple more Notes:
- You MUST use x-includes and x-libraries. Tk in their wisdom ships some really old X11 Headers. Not putting this in will end up with a _BSDgettimeofday error when you build up Python
- Same Flags are required as Tcl.
- You verify this by typing
file wishand check for 64-bit..
./configure --enable-framework MACOSX_DEPLOYMENT_TARGET=10.5 --with-universal-archs=intel --enable-universalsdk=/ make sudo make installLast Notes:
- You should end up with no errors
- Same as before verify this by typing
file Pythonand check for 64-bit..