Homebrew overriding compiler set in Xcode projects #6406
Comments
4.0 or later, I believe. Being able to do the equivalent of --use-clang in the formula would be a temporary workaround, but it wouldn’t really fix the underlying issue of homebrew overriding xcodebuild. |
Xcode-based projects are problematic for Homebrew in general, especially in the face of 10.5 SDK dropping. |
The 10.5 SDK dropping is probably an upstream issue for the projects—if they want to build on 10.7 they’ve got to deal. |
You gotta be kidding me! Homebrew simply won't work with Xcode 4.x? Why aren't you advertising this far and wide? How was I supposed to know? So now, after going through all the pain of un-installing MacPorts, and getting set up with Homebrew, now I am going to have to go back? This is actually pretty darned outgrageous. |
Uhhhh… I don’t think that’s what it means at all. The mogenerator formula won’t work with 4.0 or later, and while others may suffer the same fate it’s the only one I’m directly aware of. That doesn’t mean homebrew doesn’t work with Xcode 4; I’m happily using it on 10.7 with 4.1, for example. I’m just trying to resolve the issue with the mogenerator formula and seeking guidance from the homebrew devs on what seems like a strange issue with formulae that use xcodebuild. No need for panic, I think. |
I guess I misunderstood. Can anybody point me to a fix then for the "Can't find gcc 4.0.x..." issue? It seems pretty clear that it was caused by the installation of Xcode 4.1. |
Are you sure you don't have gcc? Maybe it's just not in your path? Try: export PATH=$PATH:'/Developer/usr/bin' |
imagesafari: Xcode 4 does not include GCC 4. It includes LLVM-GCC but that is going to go away sooner or later; Apple is throwing all their weight behind clang. |
Hmm, that's true based on what I have (which is working fine with Homebrew as I use it anyway): [ |
Yes, I have the same. Some formulae look for GCC 4.0, however, which is unavailable. This is, of course, a different issue from brew’s overriding of the compiler that Xcode targets specify when building a formula with xcodebuild. |
Well, that's what brew reported last time I tried to install something, and also when I run "brew doctor". It's gcc from LLVM: gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00) I'm just wondering, because I could understand if certain applications were looking for 4.0.x... but when "brew doctor" reports it as a problem, it seems to me that something is wrong. |
Just to clarify: gcc 4.0.x is not included in XCode 4.x. If you have it, it is just a holdover from XCode 3.x. I believe XCode 4.1 removes gcc 4.0.x. gcc 4.2.1 is included in XCode 4.x. However it is only accessibly as |
Can you describe how we are "overriding the compiler set in Xcode projects?" All we do is set If that's the problem (which is weird sounds like a bug in xcodebuild to me), then we can detect when xcodebuild is called and unset CC for the duration. We have to set CC though, untold millions of formula fail to build without it. |
I've confirmed that this is the cause of the bug. |
@robrix said:
Whoa, really?! I remember watching a video preview of XCode 4 before it was released, and a significant portion of the presentation was devoted to showing off how awesome LLVM was, how it was going to revolutionize development, perform smart/incremental/background compilation and code-completion, blah blah blah blah… Basically, it seems to me that Apple was going to be throwing its weight behind LLVM. The video I’m referring to was before XCode 4’s release, but I didn’t think it was that old. I admit: I’m just interested in learning about this for curiosity’s sake, and I don’t even know how to program in a language that needs a compiler. But I find the concepts of compilation fascinating, and I was actually pretty excited by the stuff Apple was claiming LLVM was capable of in that video. Can somebody explain to me the benefits gained by switching compilers again? |
@Zearin, if you have access to the WWDC videos, I believe Apple's engineers can explain it better than anyone here could. You listed a lot of the reasons behind the change in your question. In my opinion, things aren't going to get worse by moving to LLVM properly :) |
@Zearin, one minor point: LLVM-GCC is not the compiler they were talking about as “the future.” Clang is what Apple refers to as the “Apple LLVM Compiler,” and that’s the one they’re moving to. LLVM-GCC is a stepping stone between GCC and clang. It was always going to be temporary. |
@mxcl Thanks dude! |
Oohhhh! Yeah, I think that’s it. That video is actually where I heard about this thing called “LLVM” for the first time. Before that, the only compiler I was aware of (for C/C++/ObjC anyway) was plain old vanilla GCC. Then I noticed that there were files called So now I’m finally starting to realize that, although I always knew that “LLVM” means “Low Level Virtual Machine”, I thought that it was a name chosen for a specific project. If I’m reading you correctly @robrix , then what you’re saying that “LLVM” is a type of compiler, and that LLVM-GCC is just GCC’s implementation of an LLVM. Is that correct? |
@Zearin Close. LLVM is an overall project that can be used to write compilers. http://llvm.org for more information. Incidentally, I think they consider the “low-level virtual machine” expansion to be deprecated :) Apple LLVM Compiler/Clang is a specific, LLVM-based C language family (hence clang: c-language) compiler. It uses LLVM to generate machine code on the back-end, and uses its own parser and abstract syntax tree. http://clang.llvm.org for more info. LLVM-GCC pairs GCC’s front-end (parser, etc) with an LLVM code generator back-end. Since it uses GCC’s parser, etc, it retains most of the performance/error reporting issues of GCC, but it does generate better code in many cases; it was a stepping stone developed at Apple, IIRC. So, LLVM isn’t really a type of compiler; rather it’s a specific project whose libraries are leveraged by both LLVM-GCC and clang. |
"Low-Level Virtual Machine" will always be an appropriate expansion for that project as all LLVM compilers target assembly code for a virtual machine---hence the "low level" part. As a final step, this virtualized assembly is converted into native object code. The majority of optimizations that get compiler nerds all hot and bothered take place on this low level virtualized assembly code so "Low-Level Virtual Machine" is an apt description of the thing they are hacking on. |
The compiler setting in the xcodeproj is overridden by the CC setting in the environment. This is a bit insane IMO since the xcodeproj itself has detailed decisions about what tools to use. Fixes Homebrew#6406.
The compiler setting in the xcodeproj is overridden by the CC setting in the environment. This is a bit insane IMO since the xcodeproj itself has detailed decisions about what tools to use. Fixes Homebrew#6406.
The compiler setting in the xcodeproj is overridden by the CC setting in the environment. This is a bit insane IMO since the xcodeproj itself has detailed decisions about what tools to use. Fixes Homebrew#6406.
The compiler setting in the xcodeproj is overridden by the CC setting in the environment. This is a bit insane IMO since the xcodeproj itself has detailed decisions about what tools to use. Fixes Homebrew#6406.
The compiler setting in the xcodeproj is overridden by the CC setting in the environment. This is a bit insane IMO since the xcodeproj itself has detailed decisions about what tools to use. Fixes Homebrew#6406.
Why does homebrew override the compiler set in Xcode projects? If there's not a good reason for this, it probably shouldn't do this by default.
For a working example, try compiling mogenerator with Xcode 4.1 or later installed —
brew install mogenerator --HEAD
.The text was updated successfully, but these errors were encountered: