[Pythonmac-SIG] 64-bit Python?

Ronald Oussoren ronaldoussoren at mac.com
Thu Jun 5 15:08:46 CEST 2008

I've just commited support for building python as a 4-way universal  
binary to the python repository (revision 63955).

What does does:

This patch adds a new configure argument on OSX:

When used with the --enable-universalsdk option this controls which
CPU architectures are includes in the framework. The default is 32-bit,
meaning i386 and ppc. The most useful alternative is 'all', which  
all 4 CPU architectures supported by MacOS X (i386, ppc, x86_64 and  

This includes limited support for the Carbon bindings in 64-bit mode  
as well,
limited because (a) I haven't done extensive testing and (b) a large  
of the Carbon API's aren't available in 64-bit mode anyway.

I've also duplicated a feature of Apple's build of python: setting the
environment variable 'ARCHFLAGS' controls the '-arch' flags used for  
extensions using distutils.

How to build the tree:

- Checkout a copy of the python trunk (that is, the code that will be  
python 2.6 in the future)
- in the root of that checkout:
- mkdir build
- cd build
- ../configure --with-framework-name=Python64' '--with-universal- 
archs=all' '--enable-framework' '--enable-universalsdk=/'  
- make
- sudo make install

This will install a 4-way universal build of Python 2.6 in /Library/ 
Frameworks/Python64.framework. Add the 'bin' directory inside the  
framework to your shell's PATH to use this.   Note how the framework  
name is "Python64.framework" and not "Python.framework", this allows  
you to easily remove this build.

There a 3 variants of the command-line interpreter: python-32,  
python-64 and python-all, python-32 will always run in 32-bit mode,  
python-64 runs in 64-bit mode and python-all will run in whatever mode  
is available on a machine. The command "python" without a suffix is an  
alias for python-32 (because most GUI libraries aren't available in 64- 
bit mode yet).

Distutils will build extensions 4-way universal as well, use ARCHFLAGS  
to override this (as documented on Apple's website).

There are some minor issues in this build:
- the tools installed in /usr/local/bin don't include the 3 variants
- I haven't tested the Carbon bindings in 64-bit mode.

I'll be traveling for the next couple of weeks (WWDC and then some  
down time) and will probably not be able to provide support during  
this time. Please file bugs about any issues with this configuration,  
preferable including patching ;-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2224 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20080605/42b05720/attachment.bin>

More information about the Pythonmac-SIG mailing list