Python.framework seems to be missing from Xcode's 10.9 SDK.
Python.framework exists in the Xcode 10.8 SDK:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Python.framework
However, it is missing from my Xcode 10.9 SDK here:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/
This is odd, because Python.framework is still available to users on 10.9 systems here:
/System/Library/Frameworks/Python.framework
Has Python.framework been intentionally removed from the 10.9 SDK? Is this a not-so-subtle hint from Apple to stop using this framework? Or am I just confused?
This matters because I have a OS X application which links against Python.framework. It seems I cannot build my application with a Base SDK build setting of 10.9 since Python.framework is missing, and I must link to it.
I am interested in both explanations for why this framework is missing (or why I'm wrong and it's actually not missing), as well as suggestions for workarounds.
There was an official Apple support page on the subject:
Changes To Embedding Python Using Xcode 5.0
Basically, what they say is that the method for integrating with Python with the SDK Python.framework
is deprecated, and the standard *nix method of using the python.h
header should be used instead.
That is (the instructions below are a summary - please look into the linked article for more details):
#include <Python/Python.h>
with #include <Python.h>
;Python.framework
from the project build;.dylib
file to Xcode;As for the rationale, they do not detail it, they simply mention that:
Because Python is a framework, it also resides in the SDK, even though Python (or any scripting language) has difficulties being in two places. Due to both long-term and recent issues, it was decided to remove Python from the SDK.
I ran into (and solved) this problem as well:
/bin/sh ../libtool --silent --tag=CC --mode=link gcc -I../include -I../ -g -O2 -Wall \
-isysroot <blah>/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk \
-Wl,-F/System/Library/Frameworks \
-framework Python \
-u _PyMac_Error \
-o libdnet.la -\
rpath /usr/local/lib *.lo
The things that jumped out to me initially were that the gnu libtool I was using had done the -Wl
flag append on the front of the -F
. So, I added
-F/System/Library/Frameworks
-L/System/Library/Frameworks (just to be safe)
Then, the other thing that was pretty obvious was that '-framework Python' didn't have the .framework suffix like usual. So, I added that as well
-framework Python.framework
I still couldn't get things to work. Then I figured out what it was:
Long story short, and I don't know why it works or why they changed anything, and I'm particularly miffed that the Python.framework isn't in the SDK anymore (Granted, it was always weird linking to it, but it'll take me a while to retrain myself..
-framework
just needs to be changed to -f
Bonus round, there's a Python system wide settings object, as well as the 'python-config' CLI program that will need to be fixed so they don't propogate this bad setting any more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With