On May 13, 2010, at 7:07 PM, Howard Rodstein wrote: I have spent much of the day trying to understand what "Mac OS X Deployment Target" means (because I support a bunch of sample Xcode projects used by people running OSes from 10.4 to 10.6). I am just as confused as when I started.
The Xcode SDK Compatibility Guide says (page 12): When you build your application, your Deployment OS version selection is reflected in the MinimumOSVersion entry in the application's Info.plist file.
However I set Mac OS X Deployment Target to 10.5 and compiled and examined the Info.plist file in the built executable package. There is no MinimumOSVersion key in there.
That's a convention in the Info.plist files in many project templates. It may not be in yours. Anyway, that is a side-effect, not the primary purpose, of Deployment Target. The tips displayed at the bottom of the Xcode 3.2.2 build settings tab (on OS X 10.6.3) when you select Mac OS X Deployment Target say: "Mac OS X 10.5 - Code will not load on systems earlier than 10.5"
Empirically this does not seem to be always true. I compiled a plug-in with Mac OS X Deployment Target set to 10.5 but it still ran on OS X 10.4.11.
Plug-ins might. Launchables usually don't. And if you run any code on an OS earlier than its Deployment Target, it will likely crash when it attempts to make a system call to code that isn't there. However setting Mac OS X Deployment Target to "Compiler Default" or 10.6 generated an executable that failed to dynamically link on OS X 10.4.11.
Why would it run on 10.4.11 with Deployment Target set to 10.5 but not with it set to 10.6?
Changes in the runtime model between 10.4/10.5 and 10.6. Is this because different OS glue routines are linked based on the Deployment Target and I got lucky with DT=10.5 but not DT=10.6?
What exactly does "Mac OS X Deployment Target" do? It seems to have side-effects beyond controlling whether linking is strong or weak.
Exactly: it sets the -mmacos-version-min flag to the compiler and linker. This causes the compiler and linker to do the following: • Generate code for the runtime model of that version of the OS • Link against the runtime libraries for that version of the OS • Weak-link against imported library symbols that are defined to exist in the system headers but are not implemented in the deployment target version • Any other behaviors your project build settings, source or header files, or Info.plists base off of MACOSX_DEPLOYMENT_TARGET The projects that I am responsible for need to be compilable and runnable on OS X 10.4.11 or later. They do not use any new (post 10.4) stuff.
You have defined the question. If they need to run on 10.4, you must set the Deployment Target to 10.4. If you do not use any APIs in 10.5 or later, then you can set the Base SDK to 10.4 as well. I know I could set them to use Base SDK 10.4 and Mac OS X Deployment Target 10.4
Given your requirements, that is what you should do. but I am hoping to avoid this because the 10.4 SDK is not installed by default on recent OS'es and also because using the 10.4 SDK requires using GCC 4.0 which may vanish in the next OS.
Running on 10.4 requires gcc 3.3 or 4.0. gcc 4.2 does not generate code that runs on 10.4. That probably clears up a lot of things for you. Am I stuck with specifying 10.4 for both settings?
Yes.
Chris
|