[Bf-committers] OSX compile scons use python 2.3

jonathan ferguson jdpf at edumetrics.org
Fri Nov 10 23:13:04 CET 2006


hi

just to add to the fun of what's going on in this thread...

So to reiterate, Apple ships Tiger (10.4.8) with Python 2.3 which  
lives in:

/System/Library/Frameworks/Python.framework/Versions/2.3/Python  
(compatibility version 2.3.0, current version 2.3.5)

The Developer Tools MacOSX 10.4u SDK has Python in:
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/ 
Python.framework

If you want a more recent version of python 2.4 or 2.5 you will need  
to install it using MacPorts, fink, or MacPython. Both MacPorts  
(ports) and MacPython install frameworks. The ports framework is  
safely tucked out of the way: /opt/local/Library/Frameworks/ 
Python.framework/

The MacPython installer places python in /Library/Frameworks/ 
Python.framework/ If you install the MacPython framework, it will  
change the "default" version of the Python framework from 2.3 to 2.5  
because of the search path for frameworks (see man dyld and man ld):

-framework name[,suffix]
               Specifies a framework to link against.  Frameworks   
are  dynamic
               shared  libraries,  but  they are stored in different  
locations,
               and therefore must be searched for differently. When  
this option
               is  specified,  ld  searches for framework  
`name.framework/name'
               first in any directories specified with the -F  
option,  then  in
               the  standard  framework  directories /Library/ 
Frameworks, /Net-
               work/Library/Frameworks,  and  /System/Library/ 
Frameworks.   The
               placement  of the -framework option is significant, as  
it deter-
               mines when and how the framework is searched.  If   
the  optional
               suffix is specified the framework is first searched  
for the name
               with the suffix and then without.

In summary, the search path order for frameworks is as follows:

* anywhere you specify with -F * (private)
/Library/Frameworks/ (public)
/Network/Library/Frameworks (?private?)
/System/Library/Frameworks (public)

As explored in
http://developer.apple.com/documentation/MacOSX/Conceptual/ 
BPFrameworks/BPFrameworks.pdf
In Mac OS X, there are two Public locations for Frameworks:

/System/Library/Frameworks/
/Library/Frameworks/

Frameworks can also live inside app bundles, or anywhere you  
choose--- but they are then termed as "Private Frameworks" and must  
be explicitly declared on the link-line.

For me, scons builds that followed the MacPython install  
<automatically> adopted the new framework and linked it to the  
resulting binary as a result of having /Library/Frameworks/ 
Python.framework in the linker's default search path. You can see  
this behavior from yesterday's PPC build at http:// 
blender.edumetrics.org/ (see the py2.5 version) To inspect the links  
for this binary, use otool. Like so: otool -L blender/installs/ 
blender.app/Contents/MacOS/blender

To work-around linking with python 2.5, rename the /Library/ 
Frameworks/Python.framework to /Library/Frameworks/ 
Python25.framework. This will break the links in /usr/local/ (there  
are several), and cause the linker to not find Python.framework in / 
Library--- instead linking to the one in /System.

It is also important to note that scons has a default prepended path  
that includes /usr/local/bin (from scons-user.pdf): path = [’/usr/ 
local/bin’, ’/bin’, ’/usr/bin’]

As lukep says, if you don't have a complete framework for /System/ 
Library/Frameworks/Python.framework/Versions/2.3/Python--- the  
Operating System has been broken--- and you'll need to reinstall Mac  
OS X. However, i emphasize the need to verify that the /System files  
were actually changed. It seems quite unlikely to me.

have a nice day.yad
jdpf



More information about the Bf-committers mailing list