2
votes

I am using XCode 4.6.1 with OSX 10.8.5. I tried to compile a project but got this error

error: -fobjc-arc is not supported on platforms using the legacy runtime    
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

I tried to resolve it like its OSX deployement target to 10.8 from 10.9 but did not worked then tried this as well Clang Error in XCode

but not working. Please any idea or help appreciated.

3
How can you set an OS X deployment target for a iOS app?Martin R
In project properties -> Deployment -> OS X Deployment TargetJason W
There seems something to be wrong in your project. If this is for an iOS app then there should be a iOS deployment target setting, not OS X deployment target.Martin R
this is not an ios app. it is object c command line class. sorry i forgot to mentionJason W
Then you should not use the iOS tag and mention an "iOS error" in the title ... For OS X, make sure that you compile for 64-bit, not for 32-bit.Martin R

3 Answers

3
votes

ARC is only available for the modern RTE aka 64 bit on OS X.

2
votes

I think you can get an error like this when building if your project was modified by Xcode 5 and you went back to Xcode 4.6 and tried to build, because Xcode 5 can remove some things that will cause unexpected results on Xcode 4.6. But it sounds like this mainly applies to OS X projects and not iOS ones, so I'm confused as to why this would happen for iOS. I would suggest trying to build your project with Xcode 5 to see if that resolves the issue.

If you take a look at this, you can see a long explanation for the reason that this happens. But basically Xcode 5 has a different "default" for some compiler settings than Xcode 4.6, and Xcode 5 recommends removing certain settings sometimes because of this, which makes Xcode 4.6 behave differently.

A good solution, since it sounds like something might have gotten messed up with your project (since it's showing options for OS X for a supposedly iOS project), is to create a new project and move your files over. If your project is under source control and you don't want to scrap your current repository and revision history, you could always create a new project and compare the project files to see what differs between it and a clean Xcode 4.6 project.

1
votes

I resolved this problem as follows:

  1. Close the project and quit XCode
  2. Make a backup copy of your project
  3. ctrl+click on your project icon and choose "Show Package Content" menu item
  4. A directory will open with file project.pbxproj in it. Open the file project.pbxproj by a text editor
  5. Find all lines

CLANG_ENABLE_OBJC_ARC = YES;

and replace them by

CLANG_ENABLE_OBJC_ARC = NO;

  1. Save project.pbxproj

(Using Xcode v 6.1.1)