Question

I've installed xcode 5 and noticed that gcc compiler is deprecated. Assuming that I don't want to switch to Apple LLVM 5.0, here come my questions:

Is it possible to use iOS7 SDK and still compile in llvm-gcc-4.2?

If yes, how to do this?

If you don't know if that's possible, please don't post answers like "use clang, man", because they are not actually answering the questions I've posted.

Was it helpful?

Solution

Apple has removed the support for llvm-gcc-4.2 in XCode 5. Even if you install and change your base sdk to 6.1 sdk, you won't be able to build using llvm-gcc-4.2. So your only option is to continue using XCode 4.x if you want to use llvm-gcc-4.2.

OTHER TIPS

LLVM-GCC is not included in Xcode 5.

I got above line from https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_5_0.html

So the question is what to use instead of llvm-gcc ?

Is it possible to use iOS7 SDK and still compile in llvm-gcc-4.2?

If you want to compile your whole app using llvm-gcc-4.2: Probably not. I haven't checked this myself, but the iOS 7 headers would only need to add a single dependency on a clang feature missing in llvm-gcc-4.2 and you're swimming in compile errors. You may be able to hack your way through them, but it would likely be easier (not to mention more future-proof) to suck it up and upgrade to clang.

If you only need to compile some of your app using llvm-gcc-4.2: Sure, as long as you don't need to import any iOS 7 headers in the parts that you build with llvm-gcc-4.2.

You could try moving the problematic bits off to a static library, compiling that with gcc, then linking in to the final app, built with clang. You won't be able to target 64-bit, as llvm-gcc-4.2 doesn't can't generate armv8 code, but it should work otherwise.

One caveat: If your static lib uses C++, there may be some problems due to ABI and std library differences. But those are solvable problems, at least.

You could use homebrew to install the gcc version you need. Most probably all your Makefiles will need to be corrected (sigh)

I did:

brew search gcc

And the results:

homebrew/versions/gcc43     
homebrew/versions/gcc45 
homebrew/versions/gcc47    
homebrew/versions/gcc49
homebrew/versions/gcc44
homebrew/versions/gcc45
homebrew/versions/gcc48    
homebrew/versions/llvm-gcc28
homebrew/dupes/apple-gcc42
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top