6 ms·
Unfortunately Apple's new Command Line Tools for Xcode doesn't include regular gcc, but Apple's gcc-compatible wrapper around LLVM (i.e. /usr/bin/gcc is a symli
by pavlov 15y ago
Unfortunately Apple's new Command Line Tools for Xcode doesn't include regular gcc, but Apple's gcc-compatible wrapper around LLVM (i.e. /usr/bin/gcc is a symlink that points to llvm-gcc).
llvm-gcc doesn't compile many projects correctly, including gcc itself (as of Xcode 4.2 there were reports that it's not possible to compile a gcc cross-compiler using llvm-gcc). Hopefully there have been improvements in this regard.
Still, anyone who needs the real gcc will have to install it through some other means.
- nknight 15y agoYou really shouldn't be using terms like "regular gcc" or "real gcc", they don't mean what you seem to think they do. GCC is a modular system specifically to provide for things like LLVM-GCC. LLVM-GCC takes the same form as other GCC back-ends for other platforms. i386 has a GCC backend, ARM has a GCC backend, IA64, MIPS, SPARC... Which of these do you nominate to be "real gcc"? The only measure by which llvm-gcc is not "real" is that it's not included in the core gcc distribution.
- pavlov 15y agoPoint taken. But when llvm-gcc doesn't compile the code that every other instance of gcc found on modern platforms does, it's hard to argue that it's the same thing. Edit -- the llvm-gcc project doesn't seem to share your opinion of the project as being "just another back-end". They certainly don't claim that it's fully compatible, only that it supports "many" features, "most" options, "a number of" extensions: "Being derived from the GNU Compiler Collection, llvm-gcc has many of gcc's features and accepts most of gcc's options. It handles a number of gcc's extensions to the C programming language." http://llvm.org/cmds/llvmgcc.html http://llvm.org/cmds/llvmgcc.html
- grandalf 15y agoIt's just a tradeoff. LVM offers certain benefits, at the expense of being completely full featured.
- nknight 15y agoThis is SOP for GCC backends. Not all platforms support all GCC features. And if you really think there aren't problems building the same code across the various official GCC backends, you're not paying attention. Ask the Linux kernel guys about GCC's code generation oddities.
- w0utert 15y ago"And if you really think there aren't problems building the same code across the various official GCC backends, you're not paying attention. Ask the Linux kernel guys about GCC's code generation oddities." You don't even have to go as far as kernel developers. From a 'write once, compile everywhere' perspective, GCC is actually pretty bad. I used to work at a company that built and deployed to somewhere in the neighborhood of 20 different *nix platforms, over 6 different hardware architectures, running various GCC versions. Working around version- or backend-specific GCC issues was almost a daily task, and it wasn't getting any better with later versions. It's not that GCC is 'bad', but it's not holy either, not by any stretch of imagination. There's a reason Apple decided to push clang as an alternative. I believe clang+LLVM will some day replace GCC on Linux and other platforms that use GCC as well.
- CJefferson 15y agoNo no, LLVM-GCC really isn't "real gcc". All the backends which gcc publish share huge amounts of code, in particular all the optimizations framework in the shape of the SSA representation and GIMPLE, support for generating debugging information via DRAWF. LLVM-GCC just takes the minimum amount of GCC and replaces the entire back-end.
- scrod 15y agoI'll install Apple's LLVM frontend when I can use it to generate ppc object code.
- sparky 15y agoLLVM has had a PowerPC backend for years http://llvm.org/docs/CodeGenerator.html#targetfeatures http://llvm.org/docs/CodeGenerator.html#targetfeatures . Do you mean something more specific?
- scrod 15y agoYes, I'm aware. It's Apple's LLVM that lacks PowerPC code generation: http://stackoverflow.com/questions/7137480/how-do-i-add-ppc-ppc64-support-back-to-xcode-4-2-under-lion http://stackoverflow.com/questions/7137480/how-do-i-add-ppc-... http://www.cocoabuilder.com/archive/xcode/299924-no-ppc-from-xcode-4.html http://www.cocoabuilder.com/archive/xcode/299924-no-ppc-from...
- nknight 15y agoNew tools lose support for obsolete platforms, film at 11? It's been 6 years. The world has moved on, and Apple no longer has any commercial interest in PowerPC. You really expect them to keep bothering with it?
- scrod 15y agoI'm not really concerned with Apple's financial interests. I'm concerned with their software tools and their demonstrated willingness to support the hardware they sell.
- zmanji 15y agoWhy is it not possible to compile gcc with llvm-gcc? The last time I checked llvm-gcc compiles C and C++ with most GNU extensions.
- jensnockert 15y agoBecause of bugs and age, the gcc-gcc that Apple shipped when it shipped gcc-gcc couldn't compile the latest gcc either. (And llvm-gcc is based on that version, which is 4.2.1 or something, about 5 years old)
- pavlov 15y agoThe gcc installed by Xcode 4.0.2 is able to compile working gcc cross-compilers. The llvm-gcc installed by Xcode 4.1+ isn't. This is problematic for the Cocotron project [1], which is an Xcode-compatible cross-compiler environment for creating Windows/Linux ports of Cocoa apps. Currently one has to revert to Xcode 4.0.2 to build Cocotron's cross-compiler, then upgrade back to 4.2... This is not terribly convenient. (I guess the long-term solution is that Cocotron either has to add a dependency on a non-Apple gcc, or needs to switch to clang for its cross-compiler.) [1] http://code.google.com/p/cocotron/ http://code.google.com/p/cocotron/
- jensnockert 15y agoYes, but the current Xcode doesn't include non-llvm gcc, so it isn't really a surprise that the Command Line Tools for Xcode doesn't include it either.
- brigade 15y agoDoes clang compile these projects correctly? If not, have you filed a bug? (http://llvm.org/docs/HowToSubmitABug.html http://llvm.org/docs/HowToSubmitABug.html)
- adestefan 15y agoMost of the times you should be submitting bugs to the program that won't compile instead of clang. A lot of software that doesn't compile with clang depends on gcc extensions (most of which are now "official", but have different syntax) or broken behavior in gcc.
- zokier 15y agoI doubt that a five year old GCC would much better choice for average developer/homebrew-user.
- simmons 15y agoI ran into this problem, myself, after I upgraded Xcode a while back. Fink was no longer able to build a tool I wanted to install. I wonder if there's a compelling reason for these add-on distros (Fink, Homebrew, Macports) to be strictly "build from source" with no option for binary package downloads. For me, it just seems to add long delays in getting a tool installed, and adds frustrating dependencies on my Xcode version.
- 286c8cb04bda 15y ago> I wonder if there's a compelling reason for these add-on distros (Fink, Homebrew, Macports) to be strictly "build from source" with no option for binary package downloads. For that to happen, someone has to take responsibility for creating, managing, and distributing those binary packages. That's much easier said than done. So, the simple answer is that no one has, as of yet, volunteered to do the work.
- koenigdavidmj 15y agofink installs binary packages.
- simmons 15y agoMy Fink seems to always want to perform builds, but I haven't really studied it closely. I have a vague recollection of it offering binary packages for Leopard but not for Snow Leopard when I installed it, back in mid-2010. If Fink can provide binary packages for SL now, I definitely need to look into it.
- astrange 15y agoNobody has been able to volunteer the CPU time to build binary packages, so there haven't been any to download. Fink ships apt-get which is still perfectly capable of using them.
- mikemcquaid 15y agoHomebrew does have binary packages (we call them bottles). I'm the guy who implemented the feature and I am realising that as I didn't shout very loudly people don't realise that it exists. For example Qt has a bottle: https://github.com/mxcl/homebrew/blob/master/Library/Formula/qt.rb https://github.com/mxcl/homebrew/blob/master/Library/Formula... The reason we aren't doing this for more packages is basically people power and hosting (as I'm not sure Sourceforge would be happy we hosting the number of binaries we'd want to have). Hope that explains a bit. Feel free to comment if you think we're taking a good/bad approach here.
- ConstantineXVI 15y agoPresuming one can get it to compile; is there any reason we can't have gcc in Homebrew now? Since it's not included anymore, it doesn't clobber any default software[1] (anything that expects `gcc` to be ordinary gcc stands a chance of breaking anyway) [1] https://github.com/mxcl/homebrew/wiki/Acceptable-Formula https://github.com/mxcl/homebrew/wiki/Acceptable-Formula
- jensnockert 15y agoI use FSF/GNU/GCC-gcc as my primary gcc, unfortunatly it breaks almost every project that have OS X build scripts since it doesn't accept a lot of Apple-specific options (-arch, I am looking at you).
- mikemcquaid 15y ago`brew install https://raw.github.com/adamv/homebrew-alt/master/duplicates/gcc.rb` https://raw.github.com/adamv/homebrew-alt/master/duplicates/... should work.
- jey 15y ago> llvm-gcc doesn't compile many projects correctly, including gcc itself While strictly true, it's kind of irrelevant. The official stance is that GCC is the only compiler that is supported to build recent versions of GCC. This has been true since some point around GCC 4.0.
- alwillis 15y agoHere's what I recommend for installing "real" gcc: http://caiustheory.com/install-gcc-421-apple-build-56663-with-xcode-42 http://caiustheory.com/install-gcc-421-apple-build-56663-wit...
- mikemcquaid 15y agoGCC has been on the way out for a long time since they switched to GPLv3. The latest GCC version provided by Apple was 4.2 which is really quite outdated now. Clang is a faster and BSD-licensed compiler that Apple is putting all its weight behind now. LLVM-GCC has also been deprecated as it was removed as-of LLVM 3.0. Clang is the future and it's the default compiler with the Command Line Tools. We just need to wait for upstreams to fix the various issues. It's worth noting that this is why monocultures are bad. For all the love of GCC (and it is great) we now have a huge quantity of open-source software that only compiles with one compiler. This is a shame and hopefully Clang will help rectify that.
- super_mario 15y agoThat also means a huge amount of open source software that makes OS X more useful (esp. as a developer OS) is going to get harder and harder to compile on OS X. Which in turn is making OS X a less attractive platform.
- mikemcquaid 15y agoYou could make the same argument about 64-bit Linux. It got fixed. The same will happen on OSX. People (myself included) will write patches and get them accepted upstream.
- koenigdavidmj 15y agoThen such software should be modified so that it does not depend upon GNU extensions.