[Pythonmac-SIG] Some questions about going to MacOS X 10.4

Bob Ippolito bob at redivi.com
Wed Aug 24 19:46:56 CEST 2005


On Aug 24, 2005, at 6:35 AM, Kent Quirk wrote:

> To this end, Bob, what would it take to make it possible to create
> 10.3-capable builds from 10.4?

Build as much as possible on 10.3, and anything you build on 10.4  
should be build against the SDK with GCC 3.3 (if you care about  
pre-10.3.9).

The most important thing is to build as much as possible on the  
target platform.  For example, Python itself does a lot of feature  
detection in its configure script, and it will find things that the  
target platform may not have, and will not work there!  In your own  
code, you can avoid this, but do not trust ANYTHING you did not write  
to be portable unless you've tested it.

> In other words, is it technically feasible to support this? If so,  
> what
> has to be changed?

It's possible to do, but it's a royal pain.  I do it for our  
products, but we don't (and likely won't) support x86, because it's  
just an installer and isn't worth the universal binaries trouble  
since they don't go anywhere near 10.2 and we do.

> If you could document what needs to happen, maybe some of the rest  
> of us
> could tackle the pieces.

This is the interesting from the script that runs setup.py:

import os
from subprocess import Popen

# Python.framework for 10.2, plus a python2.3 executable are in the  
"deps" folder
PYTHON_ENV = dict(os.environ)
PYTHON_ENV['DYLD_FRAMEWORK_PATH'] = os.path.abspath('deps')
Popen(['deps/python2.3', 'setup.py', 'py2app'], env=PYTHON_ENV).wait()

This is what we do at the top of our setup.py:

import os
# check to make sure we're running against the 10.2 Python
if os.path.abspath('deps') not in os.environ.get 
('DYLD_FRAMEWORK_PATH', ''):
     raise RuntimeError, 'This is the wrong Python'

# Try and compile in a 10.2 compatible manner
os.environ['CC'] = '/usr/bin/gcc-3.3'
deps = os.path.abspath('deps').replace(' ', '\\ ')
os.environ['LDSHARED'] = '/usr/bin/gcc-3.3 -Wl,-x -Wl,-F%s -bundle - 
framework Python' % (deps,)
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.2'
JAGUAR_SDK = '/Developer/SDKs/MacOSX10.2.8.sdk'
if os.path.exists(JAGUAR_SDK):
     os.environ['NEXT_ROOT'] = JAGUAR_SDK
     os.environ['DYLD_LIBRARY_PATH'] = JAGUAR_SDK + '/usr/lib' + ':'  
+ JAGUAR_SDK + '/usr/lib/system'
     os.environ['DYLD_FRAMEWORK_PATH'] += ':' + JAGUAR_SDK + '/System/ 
Library/Frameworks'


> Especially with the intel stuff coming down the pike, I'd dearly  
> like to
> be able to develop the C++ portions of my app under 10.4 and XCode  
> 2.1,
> but still ship apps that could run under 10.3.

This is ESPECIALLY hard to do, because you basically have to compile  
it with gcc 3.3 (for ppc), then compile it with gcc 4 (for x86)  
somewhere else and then lipo everything together.  Unless you only  
care about 10.3.9, in which case you could build with gcc 4 against  
the universal SDK.  I think PyObjC has some experimental code in its  
setup.py to build against the universal sdk (look for -isysroot --  
the SDK flags changed in gcc4).

-bob



More information about the Pythonmac-SIG mailing list