How to link a specific version of the framework in Xcode?

I have an application that references OS X Python.framework. Since Snow Leopard has been upgraded to Python 2.6, the framework now includes versions for 2.4, 2.5, and 2.6. However, my program does not seem to want to refer to 2.6, and this leads to errors when trying to use functions from the newer Python runtime.

I know that I can just use install_name_tool to change the binding in the post-build phase, but is there a way to just specify where to bind it during the build? This seems to be a pretty common use case.

+6
frameworks xcode version macos
source share
2 answers

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

1) DO NOT add a framework to an Xcode project

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

3) You will also want to set the scope 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 that Apple may make. For example, everything will break if it later removes 2.5 from the framework. It would be much better to just upgrade the application to work with the current version of Python.

+2
source share

I also had this specific problem, and I could not find a way to get Python Framework 2.6 in the assembly.

I could not get the work of OTHER_LINKER_FLAGS to work, alas.

So, as expected in SJML, I used the post-build step like this:

# # Force the required version of Python to be 2.6 # dvb10.12.01 install_name_tool \ -change \ /System/Library/Frameworks/Python.framework/Versions/2.5/Python \ /System/Library/Frameworks/Python.framework/Versions/2.6/Python \ $TARGET_BUILD_DIR/omino_python.plugin/Contents/MacOS/omino_python 

Just put it there for grepping. :)

+1
source share

All Articles