On Sep 7, 2006, at 11:49 AM, Mike Lazear wrote:
On Sep 6, 2006, at 7:08 PM, Chris Espinosa wrote:
On Sep 6, 2006, at 3:56 PM, Mike Lazear wrote:
When using gcc 4.0 and wanting to run on 10.3.9 (ppc)
which SDK do I use MacOSX10.4u.sdk or MacOSX10.3.9.sdk?
It depends on whether you want the app to be able to take advantage of 10.4 features when it's actually run on 10.4.
If you use the 10.3.9 SDK, you'll be limited to 10.3.9 API and functionality.
If you use the 10.4u SDK, you can use 10.4 APIs, but your code will have to check at runtime to see what version you're running on before calling APIs introduced in 10.4.
That is the most clear, direct answer I've seen on the subject.
Actually, there was a really clear answer given back in June.
On Jun 21, 2006, at 5:25 PM, Chris Hanson wrote:
Actually, you should be able to target 10.3.0 and later using any of the SDKs. There are three build settings that are relevant to which operating system versions your application is targeting:
1. GCC_VERSION defines the compiler to use.
2. SDKROOT defines the version of the headers to include and libraries to link against; in other words, it is the *maximum* Mac OS X version whose features your software will take advantage of.
3. MACOSX_DEPLOYMENT_TARGET defines the *minimum* Mac OS X version you want your software to run on; in other words, APIs released after the specified deployment target version will be weak-linked and must be checked for at run-time before they are called.
You can of course set these differently per-architecture.
Thus you can build against the 10.4 Universal SDK and target 10.3.0 just fine by setting your SDKROOT to 10.4u, your MACOSX_DEPLOYMENT_TARGET to 10.3, and your GCC_VERSION to 3.3. If you do this, any APIs defined later than 10.3 will be weak-linked and you will have to be careful not to call any APIs that do not exist in 10.3.0 in your code. But if you are careful, your code should run.
And as he mentioned, adding _ppc or _i386 as a suffix to the above settings will let you control per-architecture build details for universal binaries. For example, I use:
GCC_VERSION_ppc = 3.3
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4
MACOSX_DEPLOYMENT_TARGET_ppc = 10.3
SDKROOT = 10.4u
to build a PPC binary that runs on 10.3.0+ (thus built with gcc 3.3), and an Intel binary that runs on 10.4+. The 10.3 PPC build tests for the existence of 10.4 API functions, otherwise handles a feature the "old way."