Objective-C ARC and Legacy Runtime compiling error - objective-c

I'm trying to compile sources with Xcode 4.6, for 32bit architecture, but getting 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
What's wrong?

You're mixing ARC (automatic reference counting) with the older Objective-C 1.0 runtime, which does not support ARC.
32-bit apps on OSX, automatically use the 1.0 Runtime, so you'll have to disable ARC for your project, and use Manual Reference Counting.

This problem recently resurfaced because Xcode 5 removes the ARCHS parameter - if you let it. But if you have a build server with Xcode 4 this defaults there to building 32 and 64 bit, which fails if you have ARC enabled.
See my writeup for a more detailed explanation.

Related

xCode 6.3.2 - arm64 Conversion

What is quickest way to convert old iOS Application written in ObjC to arm64.
When I updated valid architectures to arm64, I get tones of errors, framework missing, clangs.
Do xCode 6.3.2 Provide any help in conversion?

XCode Objective-C - Legacy to Modern [duplicate]

I'm trying to compile sources with Xcode 4.6, for 32bit architecture, but getting 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
What's wrong?
You're mixing ARC (automatic reference counting) with the older Objective-C 1.0 runtime, which does not support ARC.
32-bit apps on OSX, automatically use the 1.0 Runtime, so you'll have to disable ARC for your project, and use Manual Reference Counting.
This problem recently resurfaced because Xcode 5 removes the ARCHS parameter - if you let it. But if you have a build server with Xcode 4 this defaults there to building 32 and 64 bit, which fails if you have ARC enabled.
See my writeup for a more detailed explanation.

Why Can't I Compile Objective-C/C++ (.mm) Files with MacPorts gcc-mp-4.6?

I have a C++11 codebase I compile with gcc 4.6 from MacPorts on OS X Lion. I also need to compile and link some OS-specific Objective C/C++ files to make the final executable. I would like to use the same compiler version to compile the whole project, but I cannot get the MacPorts version 4.6 of gcc to recognize Objective-C files; it always attempts to interpret them as C++ code and ignores the .mm file extension. (Compiling these files does work with the Xcode version of gcc, just not the MacPorts one. However that gcc is version 4.2 and I want to compile everything with gcc 4.6 or later.)
Forget IDE's or build tools: I get the same result from a commandline invocation of the compiler. That is, I record a commandline that works for compiling .mm files with the Apple gcc, verify yes it does work from the commandline, then run the identical command with nothing changed but the compiler used and it doesn't work. What am I missing?
It appears maybe the specific problem I'm having might be due to an Apple specific language extension, as the specific error I get is the same as this quote from a blog post:
After adding this, I was good for about 30 seconds until I get to the
portion of my project where some COCOA Objective-C UI stuff was being
compiled.
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSTask.h:75:24:
error: expected unqualified-id before '^' token
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSTask.h:75:24:
error: expected ')' before '^' token
Uh oh. I know what this is. This is the Apple "blocks" language
extension. It appears that blocks are used in a bunch of the system
header files. I don't think there is going to be a way to get around
this using MacPorts gcc. The FSF gcc just doesn’t know about blocks.
Fortunately for me, I didn't have anything in the Objective C/C++ code
that needed to be compiled with gcc 4.6 so I just had this target
compile using clang.

Xcode 4.4 + OSX 10.5 as Development target = Clang LLVM 1.0 error

Try this on the new Xcode 4.4: create a new project, a Cocoa application, and set the Development Target to OSX 10.5.
If you run it, you'll get this error:
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
Can someone explain this? I want to support Leopard too in my projects but I get this error if I try to execute them.
Make sure your project does not use ARC. ARC is not supported on Leopard.
(It is supported on Snow Leopard, sans weak references)
The actual error, btw, is probably before the line you copy/pasted in your question.

Apple LLVM compiler 3.0 error when using sharekit in ios5

I added Sharekit in ios sdk 5.0. I even turned down the automatic reference counting for every single file present using "fno-objc-arc" I'm getting "LLVM compiler error". I have no idea what exactly the problem is. Could you guys help me out? Below is the source code link
http://www.skytel.mobi/stepheniphone/iphone/newlywed.zip
ERRORS:
1)Apple LLVM compiler 3.0 Error
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
2)UNCategorized
Build task failed without generating error messages.
Did you try setting the debugger to GDB (in Product/Edit Scheme). There seems to be some issues with LLDB and breakpoints, especially if you are breaking on all exceptions.