Author mirell
Recipients blb, brett.cannon, dmw, easel, eric.smith, grdnwsl, jmr, jnoller, mark.dickinson, mirell, mitchellh, ned.deily, ronaldoussoren, xaoslaad
Date 2009-09-02.03:17:05
SpamBayes Score 4.70458e-09
Marked as misclassified No
Message-id <1251861428.47.0.782899378121.issue6802@psf.upfronthosting.co.za>
In-reply-to
Content
This patch allows compiling, and forces everything to be x86_64. 
However, Python 2.6.2 still dies when attempting to install: 

cd Mac && make installmacsubtree DESTDIR=""
DYLD_FRAMEWORK_PATH=/tmp/Python-2.6.2:  ../python.exe 
./scripts/cachersrc.py -v 
/tmp/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/pyth
on2.6/plat-mac 
/tmp/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Mac/Tool
s
Traceback (most recent call last):
  File "./scripts/cachersrc.py", line 44, in <module>
    main()
  File "./scripts/cachersrc.py", line 41, in main
    os.path.walk(dir, handler, (verbose, force))
  File "../Lib/posixpath.py", line 224, in walk
    func(arg, top, names)
  File "./scripts/cachersrc.py", line 23, in handler
    macresource.open_pathname(os.path.join(dirname, fn), 
verbose=verbose)
  File "/private/tmp/Python-2.6.2/Lib/plat-mac/macresource.py", line 81, 
in open_pathname
    refno = Res.FSpOpenResFile(pathname, 1)
AttributeError: 'module' object has no attribute 'FSpOpenResFile'
make[1]: *** [installmacsubtree] Error 1
make: *** [frameworkinstallmaclib] Error 2

This is both with MacPorts, and without MacPorts, in the path, just for 
those who were wary that this was solely a MacPorts issue. 

The reason it is dying is because a large number of the calls in Carbon 
are completely non-existant in 64-bit userspace. An example would be FSpOpenResFile as seen above. 

Apple issued a notice stating that many of these calls would not exist 
in Carbon 64-bit 
(http://developer.apple.com/mac/library/documentation/Carbon/Conceptual/
Carbon64BitGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40
004381-CH1-SW1). 

What Apple apparently did for their shipped version of Python in Snow 
Leopard was a hack to combine 32-bit parts of Python for Carbon 32-bit 
support, and 64-bits. 
(http://www.opensource.apple.com/source/python/python-44/)

The only way I see currently to compile Python 2.6.2 natively on Mac OS 
10.6 (On a *64-Bit Capable* machine, this is critical) is to add the 
EXTRA_CFLAG "-m32" and patch Makefile.in, for two sections which 
completely ignore/don't include EXTRA_CFLAGS or PY_CFLAGS, or any 
CFLAGS. This pretty much limits you to a 32-bit version of Python. 
Because even doing "--host=i686-apple-darwin10 --target=i686-apple-
darwin10 --with-universal-archs=32-bit", since the default gcc target on 
a 64-bit capable machine is x86_64, it still produces x86_64 code in 
some areas.

By doing this, I was able to get Python 2.6.2 to compile *and* install. 
I'll submit a patch shortly, but the main issue is of course that 
plat_mac contains many 32-bit only references to the Carbon API. The 
true fix is to fix that area. But in the interim, you'll have to compile 
Python as 32-bit.

Also, the configure.in patch won't suffice for now, since you *can't* 
build a 64-bit version of Python on MacOSX from what I've seen, and also 
as reported by several other users on MacPorts.
History
Date User Action Args
2009-09-02 03:17:08mirellsetrecipients: + mirell, brett.cannon, ronaldoussoren, mark.dickinson, blb, eric.smith, dmw, ned.deily, jnoller, jmr, easel, mitchellh, grdnwsl, xaoslaad
2009-09-02 03:17:08mirellsetmessageid: <1251861428.47.0.782899378121.issue6802@psf.upfronthosting.co.za>
2009-09-02 03:17:07mirelllinkissue6802 messages
2009-09-02 03:17:05mirellcreate