[Pythonmac-SIG] Building a 64-bit version of python

Ronald Oussoren ronaldoussoren at mac.com
Thu Apr 26 15:50:40 CEST 2007


I know several people on this list are interested in a 64-bit build  
of python. The following procedure is a hack that gets you a basic 64- 
bit build of python.


The build is universal, but for me only one of the two archictures  
actually worked: I did my build on an Intel system and the 64-bit  
build worked on that machine, but didn't work on a G5 mac. That's  
probably something shallow, but as that machine doesn't have the  
Xcode installed and is on the other side of a slow network connection  
I haven't tried to debug this yet.

1) Edit the configure script, look for "-arch i386" and "-arch ppc"  
and change that those to  "-arch ppc64" and "-arch x86_64". You'll  
have to make multiple changes to the configure file.

2) Build using:

       $ mkdir build
       $ cd build
       $ CFLAGS="-arch ppc64 -arch x86_64" ../configure --enable- 
universalsdk \
             --disable-toolbox-glue --prefix=/opt/python25-64bit
       $ make
       $ make install

3) Optionally: run "make testall" to run the unittests and check  
pyconfig.h to check the various SIZEOF definitions.

You now have a 64-bit build of python in /opt/python25-64bit.

Note that this is a quick hack and I haven't done extensive testing  
(and probably won't do so until I get around to working on a patch to  
add native support for 4-way universal builds to the python build  
process, which won't be any time soon).

Also note that several extensions won't build in this setup because  
only libSystem is 64-bit at the moment. You will therefore not have  
ssl support, zlib, bz2 and hashlib. If you want those you'll have to  
build the needed libraries (openssl, zlib, bz2, ...) as 64-bit  
binaries by hand and install those in /usr/local.

This copy of python says:

./python.exe
Python 2.5.1 (r251:54863, Apr 26 2007, 15:09:03)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> sys.maxint
9223372036854775807
 >>>

Ronald




More information about the Pythonmac-SIG mailing list