News for hackers. Stuff that matters.
Re:Xcode, GCC, and Homebrew by pavlov on Thursday February 16, 2012 @05:00PM (#3600872)
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.

Re:Xcode, GCC, and Homebrew by mikemcquaid on Friday February 17, 2012 @03:50AM (#3602695)
GCC 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.

Re:Xcode, GCC, and Homebrew by super_mario on Friday February 17, 2012 @09:42AM (#3603445)
That 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.
Re:Xcode, GCC, and Homebrew by mikemcquaid on Friday February 17, 2012 @09:51AM (#3603475)
You 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.
Re:Xcode, GCC, and Homebrew by koenigdavidmj on Friday February 17, 2012 @01:19PM (#3604357)
Then such software should be modified so that it does not depend upon GNU extensions.
Re:Xcode, GCC, and Homebrew by jensnockert on Thursday February 16, 2012 @05:09PM (#3600914)
Yes, 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.
Re:Xcode, GCC, and Homebrew by simmons on Thursday February 16, 2012 @05:24PM (#3600993)
I 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.

Re:Xcode, GCC, and Homebrew by 286c8cb04bda on Thursday February 16, 2012 @05:42PM (#3601049)
> 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.

Re:Xcode, GCC, and Homebrew by koenigdavidmj on Thursday February 16, 2012 @06:19PM (#3601190)
fink installs binary packages.
Re:Xcode, GCC, and Homebrew by simmons on Thursday February 16, 2012 @07:06PM (#3601344)
My 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.
Re:Xcode, GCC, and Homebrew by astrange on Friday February 17, 2012 @10:40AM (#3603665)
Nobody 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.

Re:Xcode, GCC, and Homebrew by mikemcquaid on Friday February 17, 2012 @03:47AM (#3602689)
Homebrew 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...

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.

Re:Xcode, GCC, and Homebrew by simmons on Saturday February 18, 2012 @01:23AM (#3606080)
I think I do have a better picture of the situation now, thanks. (And thanks to the others above who elaborated on the state of binary packaging in Macports and Fink.) I can certainly understand finite time and resources, and I'm grateful to those of you who assemble these packages.
Re:Xcode, GCC, and Homebrew by Argorak on Friday February 17, 2012 @11:37AM (#3603905)
Since 2.0, Macports can install binaries if available.

http://lists.macosforge.org/pipermail/macports-users/2011-Ju...

In my experience, those are quite common now - most of the packages I install are delivered as binaries.

Re:Xcode, GCC, and Homebrew by jey on Thursday February 16, 2012 @06:31PM (#3601244)
> 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.

Re:Xcode, GCC, and Homebrew by ConstantineXVI on Thursday February 16, 2012 @05:45PM (#3601061)
Presuming 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

Re:Xcode, GCC, and Homebrew by jensnockert on Thursday February 16, 2012 @06:14PM (#3601171)
I 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).
Re:Xcode, GCC, and Homebrew by mikemcquaid on Friday February 17, 2012 @10:05AM (#3603532)
Re:Xcode, GCC, and Homebrew by zokier on Thursday February 16, 2012 @05:24PM (#3600991)
I doubt that a five year old GCC would much better choice for average developer/homebrew-user.
Re:Xcode, GCC, and Homebrew by alwillis on Thursday February 16, 2012 @07:59PM (#3601499)
Here's what I recommend for installing "real" gcc: http://caiustheory.com/install-gcc-421-apple-build-56663-wit...
Re:Xcode, GCC, and Homebrew by zmanji on Thursday February 16, 2012 @05:08PM (#3600906)
Why 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.
Re:Xcode, GCC, and Homebrew by jensnockert on Thursday February 16, 2012 @05:11PM (#3600924)
Because 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)

Re:Xcode, GCC, and Homebrew by pavlov on Thursday February 16, 2012 @05:18PM (#3600960)
The 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/

Re:Xcode, GCC, and Homebrew by brigade on Thursday February 16, 2012 @05:11PM (#3600931)
Does clang compile these projects correctly? If not, have you filed a bug? (http://llvm.org/docs/HowToSubmitABug.html)
Re:Xcode, GCC, and Homebrew by adestefan on Thursday February 16, 2012 @06:15PM (#3601176)
Most 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.
Re:Xcode, GCC, and Homebrew by nknight on Thursday February 16, 2012 @05:15PM (#3600950)
You 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.

Re:Xcode, GCC, and Homebrew by pavlov on Thursday February 16, 2012 @05:21PM (#3600980)
Point 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

Re:Xcode, GCC, and Homebrew by grandalf on Thursday February 16, 2012 @07:24PM (#3601398)
It's just a tradeoff. LVM offers certain benefits, at the expense of being completely full featured.
Re:Xcode, GCC, and Homebrew by nknight on Thursday February 16, 2012 @08:20PM (#3601576)
This 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.
Re:Xcode, GCC, and Homebrew by w0utert on Friday February 17, 2012 @04:01AM (#3602711)
"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.

Re:Xcode, GCC, and Homebrew by CJefferson on Thursday February 16, 2012 @06:11PM (#3601164)
No 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.

Re:Xcode, GCC, and Homebrew by scrod on Thursday February 16, 2012 @06:34PM (#3601256)
I'll install Apple's LLVM frontend when I can use it to generate ppc object code.
Re:Xcode, GCC, and Homebrew by sparky on Thursday February 16, 2012 @08:11PM (#3601544)
LLVM has had a PowerPC backend for years http://llvm.org/docs/CodeGenerator.html#targetfeatures .

Do you mean something more specific?

Re:Xcode, GCC, and Homebrew by scrod on Thursday February 16, 2012 @08:20PM (#3601575)
Re:Xcode, GCC, and Homebrew by nknight on Thursday February 16, 2012 @08:34PM (#3601611)
New 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?

Re:Xcode, GCC, and Homebrew by scrod on Thursday February 16, 2012 @08:37PM (#3601613)
I'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.
Re:Xcode, GCC, and Homebrew by nknight on Thursday February 16, 2012 @08:41PM (#3601627)
Show me a mass-market PC manufacturer that continues supporting 6 year old consumer hardware.
Re:Xcode, GCC, and Homebrew by scrod on Thursday February 16, 2012 @11:17PM (#3602109)
Nope, don't try to shift the issue. We're talking about simply allowing others to compile code for PPC — not releasing brand new operating systems. Apple isn't merely ignoring it — they're going out of their way to prevent even third-parties from supporting it.
Re:Xcode, GCC, and Homebrew by chc on Friday February 17, 2012 @12:36AM (#3602310)
They're not "going out of their way to prevent third parties from supporting it" any more than everybody else who doesn't ship an operating system with a PPC compiler. That includes Windows, most Linux distros, your grandma, the corner grocer, President Obama…

Apple isn't actually stopping you from compiling for PPC. They just aren't shipping the compiler themselves. AFAIK, they don't ship any compilers for hardware they don't support — no VAX, no MIPS, no M68k — PPC is not special in that respect. I don't see what's so terrible about that.

Re:Xcode, GCC, and Homebrew by nachteilig on Friday February 17, 2012 @12:00AM (#3602227)
I don't understand this belief that Apple should support obsolete technology.

Lion is the _second_ version of OS X not to even run on PPC. Why should the developer tools they distribute for Lion support it at all?

Re:Xcode, GCC, and Homebrew by nknight on Friday February 17, 2012 @02:27AM (#3602533)
I just downloaded Xcode Tools 1.0 from Apple's developer site, for free (I'm not a paid developer). Xcode 1.0 was released in 2003 for OS X 10.3.

Also available are 1.5, 2.3, 2.4, 2.4.1, 3.0, 3.1, 3.1.1, on through to the latest 4.x versions, free for the taking. All versions prior to 4 will happily build code for PowerPC.

What is it you think they're preventing anyone from doing again?

Re:Xcode, GCC, and Homebrew by scrod on Friday February 17, 2012 @12:03PM (#3604012)
That's great. Now install one of those on Lion. And you can't run anything earlier than Lion on any Mac sold today.
Re:Xcode, GCC, and Homebrew by sbuk on Friday February 17, 2012 @02:23PM (#3604615)
If you are compiling for PPC architectures, why are Snow Leopard/Lion of any concern? This is just a pointless whine about nothing in particular. If we all shared your attitude to the advancement of technology, we'd all still be using punch cards. The PowerPC platform is dead. They announced it's death at least 7 years ago. Move on.