BuySellAds.com

Our DNA is written in Objective-C
Jump

-fobj-arc is not supported on platforms using the legacy runtime

The Cocoanaut asked on Twitter:

“Does anybody know what this error means? (compiled on a white MacBook with 10.7.5 and Xcode 4.6.3)”

He attached this screenshot:

-fobjc-arc not supported

I’ve been seeing this error quite often lately and so I’d like to document my answer for posteriority.

With each Xcode update it makes a few more or less helpful suggestions as to what settings you might be wanting to change. It saves the last Xcode version where it performed this check in the project file so that it will not bother you until the next Xcode update.

Xcode 5 suggests to remove the Architectures setting. “This will remove the setting and allow Xcode to automatically select Architectures available for the active platform and deployment target”

Remove Architectures Setting

Of course we want the warning to go away so we let Xcode perform the changes. Thanks Xcode for helping me improve my project!

One change in the project is that the LastUpgradeCheck value gets set to 0500.

LastUpgradeCheck

The second change is to remove the ARCHS setting from all build configurations.

Remove ARCHS

The warning is gone and we go on coding and debugging in Xcode 5 not suspecting that this change will be causing a problem on our build server.

Build Server Fail

I performed this suggested update on several apps and projects but when the continuos integration build kicked in it suddenly started to fail. I opened the same project that I did the changes to capture the above screen shots in Xcode 4.6 and when trying to build it it fails:

i386 PCH build failing

Hidden in the arguments for the ProcessPCH build step you can see that Xcode 4 seems to think that we would like to build this for i386 aka 32 bit.

If you create a new Mac project from template then Xcode 4.6 set the ARCHS to $(ARCHS_STANDARD_64_BIT) aka “64-bit Intel”, regardless of the ARC setting. The default setting in Xcode 4.6 for ARCHS is $(ARCHS_STANDARD_32_64_BIT) aka “Standard (32/64-bit Intel” and this is also the value that Xcode 4.6 assumes you mean if the ARCHS setting is no longer present (because Xcode 5 removed it).

32 Bit apps on Mac generally use the Objective-C 1.0 runtime, aka Legacy Runtime. This runtime version does not support ARC. Put differently, ever since you adopted ARC in your Mac apps you’ve been building for 64-bit only and now the removal of the ARCHS causes Xcode 4 to try and build for 32-bit as well.

On Xcode 5 the default value for Architectures has changed to $(ARCHS_STANDARD) aka “Standard Architectures (64-bit Intel) (x86_64)”. This is the reason why when building this Mac app with Xcode 5 you never see a problem, since it only tries to build for 64-bit.

Conclusion

Getting any build message mentioning a legacy runtime means that your compiler is trying to build a combined 32- and 64-bit application. To fix that you’ll have to either restore the ARCHS to a value that only allows 64-bit output, or you update your Xcode to version 5.

You can do so without getting the upgrade warning, because the LastUpgradeCheck will remain on Version 5 and thus remain dormant until the next Xcode update.


Categories: Q&A

%d bloggers like this: