views:

89

answers:

1

I've got an application that links against OS X's Python.framework. Since Snow Leopard has upgraded to Python 2.6, the framework now contains versions for 2.4, 2.5, and 2.6. My program doesn't seem to want to link against 2.6, though, and this ends up causing errors when I try and use features from the newer Python runtime.

I know I can just use install_name_tool to change the linking in a post-build step, but is there any way to simply tell it where to link during the build? Seems like a pretty common use case.

A: 

I have not tried this, but I believe it will work.

1) Do NOT add the framework to your Xcode project

2) Instead, use the full path to the library in "OTHER_LINKER_FLAGS" - so "/System/Library/Frameworks/Python.framework/2.5/Python"

3) You'll also want to set the framework search path to "/System/Library/Frameworks/Python.framework/2.5/" and set the include search path to "/System/Library/Frameworks/Python.framework/2.5/Headers"

However, with all that said, it will leave you vulnerable to any changes Apple may make. For example, everything will break if they later remove 2.5 from the framework. It'd be a much better idea to just update your app to work with the current version of Python.

Wade Williams
Right, I *want* to link to the newer version of Python. The problem is that my program seems to only want to link against the 2.5 version, even with the include and lib paths set. I can fix it after the fact, but that feels like a kludge.
SJML