5

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.

Kara
  • 6,115
  • 16
  • 50
  • 57
podkova
  • 1,019
  • 7
  • 16
  • 6
    Can I ask why you don't want to use `clang`? – trojanfoe Sep 19 '13 at 09:01
  • 1
    I guess that "I'm just curious" is not enough :). Let's say, there's a huge project which doesn't like being compiled in clang. In the future it will be fixed, but for now it would be great to compile it "the old way" :). – podkova Sep 19 '13 at 09:33
  • 1
    So you are willing to update it to use iOS 7 but not to fix it to use `clang`? I think your only route is to go back to Xcode 4. – trojanfoe Sep 19 '13 at 09:35
  • 1
    Apple has expressed their displeasure with the dinosaur that is GCC on several occasions and have been stating that they plan to remove it since they first started using clang circa iOS 5 since it was making their build chain miserable. If you want to stick with "the old way" you will have to stick with "the old SDK" – borrrden Sep 19 '13 at 09:56
  • 1
    The real issue Apple has with GCC is the GNU license. This is why they invested so heavily in clang and llvm. – Léo Natan Sep 19 '13 at 18:37
  • I have no idea if it works, but you could try to overwrite the default compilter using the `CC` flag, as described in [this post](http://stackoverflow.com/questions/16261612/is-it-possible-to-compile-a-newer-version-of-llvm-and-use-it-with-xcode/16265711#16265711) under (2). There may be a few (or many) flags that Xcode sets by default which are not supported by GCC. In this case, you'll probably see a warning in the build log... I currently don't have the possibility to test it myself. – hagi Sep 20 '13 at 10:56
  • @trojanfoe `clang` doesn't support the `__builtin` SSE instructions, that's how I arrived at this question. We used to use `llvm-gcc` which was previous bundled with Xcode. – robbie_c Oct 23 '13 at 20:09
  • @robbie_c A post in this thread recommends not using them anyway, and recommends using intrinsics instead: http://clang-developers.42468.n3.nabble.com/some-sse2-intrinsics-missing-td4029732.html – trojanfoe Oct 23 '13 at 20:14
  • http://clang.llvm.org/compatibility.html#vector_builtins for the lazy. I'm aware of the issue, but we have a huge data processing codebase that uses those all over the place. It sounds like OP has a similar issue. – robbie_c Oct 23 '13 at 23:02

4 Answers4

5

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.

rakmoh
  • 2,953
  • 1
  • 16
  • 14
1

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 ?

Ravindhiran
  • 5,304
  • 9
  • 50
  • 82
1

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.

Chris Devereux
  • 5,453
  • 1
  • 26
  • 32
0

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
DarthMike
  • 3,471
  • 1
  • 22
  • 18