Xcode: Per-Architecture SDK

I just crossed the website for SystemVersionCheck, an application boot-strapper that checks the Mac OS version before launching. It is meant to be used by application developers to warn of insuffisent system version prior launching, as a solution to the LSMinimumSystemVersion plist key which isn’t well supported by earlier version of Mac OS X. I have noting to say about SystemVersionCheck really, only about something I do not agree in the conclusion of its presentation page.

The SystemVersionCheck page concludes:

Developers should choose to be in one of the following categories:

A. Use gcc 4.0 and build Universal Binaries. Support 10.3.9 and later. (Easy)

B. Use gcc 3.3. Support 10.2 and later. (Easy)

C. Flex your Xcode muscles and build an application that runs everywhere. (Harder)

Now, if I say that the latest version of Gamma Control, Black Light, and Sim Daltonism were all compiled with GCC 4 and that they work on Mac OS X 10.2.8 and that they are universal binaries, what would you say? You might think: “C. … (Harder)”. But in reality it’s pretty simple, you just need to know the trick.

The trick: I use the Mac OS X 10.2.8 SDK as my target SDK, then add a SDKROOT_i386 key with value /Developer/SDKs/MacOSX10.4u.sdk as a custom setting to the target or to the whole project. Intel-GCC will now use the universal 10.4 SDK while PowerPC-GCC will use the 10.2.8 SDK. All this with GCC 4.

I found that trick late last year somewhere on the internet, maybe in an Apple mailing list archive — I really don’t remember. And it has been working pretty well for me since.


Comments

François

Nice trick, if only for the fact that GCC 4.0 does a world of difference in some applications. This is especially true since the Intel switch. Writing altivec code is truly a bad idea right now, and without an optimizing compiler, anything even mildly power-hungry becomes hellish to code properly while supporting both platforms.

Dumping GCC 3.3 once and for all (without compromising 10.2 users) is truly important to me. Thanks a lot!


  • © 2003–2024 Michel Fortin.