Deploying to OS X 10.6 and "-fobj-arc is not supported on platforms using the legacy runtime"

Steveo picture Steveo · Dec 3, 2013 · Viewed 8.4k times · Source

Background:

I'm building an app for OS X with deployment target of 10.6. I have not converted my app to ARC completely, but I am adding a few new classes which would benefit from ARC, so I have set the -fobj-arc compiler flag for those classes.

Compiling fails for Universal 32/64-bit Intel architecture, with error -fobj-arc is not supported on platforms using the legacy runtime.

Building for 64-bit only succeeds.

I'm not well versed in low level architecture. My question is: what is the effect of building for 64-bit Intel only? Does this prevent the app from running on 10.6 completely? Or only some machines running 10.6?

Answer

MaddTheSane picture MaddTheSane · Dec 16, 2013

The 32-bit runtime of OS X's Objective-C is fairly old. Apple updated the runtime when they moved to 64-bit, but didn't do much with the 32-bit runtime.

As for building for 64-bit only: Most Macs have 64-bit processors in them now. However, 10.6 does support 32-bit-only computers as well: you will be leaving those users in the dust.

I have created a header that will help with the transition to ARC, in that you can target ARC on 64-bit hardware and not on 32-bit hardware and both will work. However, this really defeats the purpose of ARC, as you will still need to manage retain and release, they'll just be commented-out when building ARC code.