简体   繁体   中英

Compiling a PyObjC application for 10.5 (Leopard) into xcode 10.6 (Snow Leopard)

I'm trying to deploy on 10.5 a PyObjC (or Cocoa-Python) application developed on Xcode 3.2.X (Snow Leopard) which runs perfectly fine on 10.6 systems.

The application doesn't launch on 10.5;it crashes at launch giving this error message (found on Crash Report):

Dyld Error Message: Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.6/Python Referenced from: /Users/myuser/Documents/myApp.app/Contents/MacOS/myApp Reason: image not found

Seems that somewhere Xcode hardcodes the Versions/2.6 python framework path (instead of setting it as Versions/Current, for example).

However, I was not able to find where this link path could be modified to be set to Current (or to 2.5, maybe conditionally)...

The path you're seeing may very well be a legitimate path to the version of the Python framework you linked against. That's the correct path for the most recent version of SnowLeopard (10.6.5), at least. You may very well have set up the path to the framework correctly in your Xcode project.

If I had to guess, I would say that when you experience this crash you are running it on a different version of Mac OS X, where the 2.6 version of the Python framework doesn't exist. To explore the issue, try navigating into the Python framework and listing the versions available on the system on which you experience this error:

cd /System/Library/Frameworks/Python.framework/Versions
ls -al

What output does that give? I'm guessing it doesn't show a version 2.6 directory. Which version of Mac OS X are you running this on? You may need to compile and link your application against an earlier version of the system in order to get it to run on whatever system you're seeing this error on.

XCode has so called SDKs which can be used to target earlier Max OS X versions from a recent one.

Currently installed SDKs can be found in /Developer/SDKs. Additional SDKs may be installed from an XCode DVD.

In a project created with XCode, SDK can be selected the following way. Open Get info of a target, find Base SDK setting inside the Architectures section. Select SDK you need and rebuild.

For example, Mac OS X 10.5 SDK contains Python versions 2.5 and 2.3 and the Current version points to 2.5.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM