Bootstrapping CC (for OSX, using Homebrew)
github.com
github.com
Turns out Xcode was never actually free: previous major releases were synchronized with OS releases. Xcode 2 came with 10.4, Xcode 3 came with 10.5.
The reason why they were "free" and Xcode 4 is not is... that Xcode 4 has been released "mid-cycle" before Lion landed. Previous Xcode were "paid" through the OS they came with, even if you downloaded them from Apple's website as it was the OS entitling you to the relevant Xcode install.
With that said, where are we so far on Xcode?
* Since Lion has not been released yet, all macbooks but Air come with the standard DVD set which contains an Xcode install
* Xcode 3.2.6 and the iOS 4.3 SDK are still available as free downloads for the Air (or to replace older Xcode installs), just go into the dev center and you are given a link to Xcode 3. You even get a download link for Xcode 3 from the Xcode 4 page: https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/...
I understand that people kind-of freakout (I did originally), but if you actually look at the events with a cool head, and previous devtools-related-events (as well as previous instances of Apple's wonky SOX-related decisions), it seems extremely likely Xcode 4 will go back to "free for everybody" on Lion, it might even be an at-install option (à la OSX Server).
Oh yeah, and there are already binary distributions of OSX compilers: http://llvm.org/releases/download.html has both Clang and LLVM-GCC binaries for OSX.
(note: "free" for everybody, Xcode 4 is already "free" if you're part of Apple's subscriber developer programs at $99/year).
On the other hand, it's annoying that Apple leaves everybody in the dark: if Lion is released in, say, 6 months. And if Xcode 4 is "free" on Lion. Does that mean non-subscribers bought 6 months of Xcode for $5? Isn't that a bit sucky?
If you use it for work, I'd expect you have a (paid) developer account, therefore you got it for free.
Professionals using Xcode for work are by far the least likely to need to pay for Xcode 4. Hobbyists or free-software developers, on the other hand...
- homebrew should just provide binaries rather than trying to bootstrap a compiler for everyone.
- Barring that, homebrew should wait and see if Xcode4 is free with Lion.
- A compiler isn't enough. You also need an assembler, linker, etc. Those can be found in Apple's cctoolz and ld64 projects.
- Headers are are also required. Those belong to Apple and are not freely redistributable.
- GCC 4.2 is still the default, not clang. Apple still builds the majority of the OS with GCC.
- Apple does modify the compiler. Look at PLBlocks (http://code.google.com/p/plblocks/) for scripts that can drive an Apple compiler build.
- homebrew is learning why "do not dupe" is not viable when dealing with Apple in the longterm, and is going to just wind up being a less mature macports clone after going through a few more release cycles.
- We can't wait for Lion, nor expect everyone to use Lion.
- The wiki page even says we need the whole toolchain
- Headers is a good point
- GCC is not the default /usr/bin/cc for Xcode4
- Yeah, we know that.
- Macports needs Xcode too.
But nothing has changed. The presence of Xcode 4 does not invalidate people's existing copies of Xcode 3 already installed or that exist on their OSX DVD. Further, the version of gcc is the same.
If this whole episode is what finally gives people the motivation to have an easier-to-install binary of gcc, then great. But the actual need is the same today as it was last week.
It may work that we can support both 3 and 4. But experience suggests that even minor build bumps of Xcode cause issues compiling software.
Ultimately it is a lot easier for us if we can say install this and use that and you will have very few issues using Homebrew.
Xcode 3.2.6 was released at the same time as Xcode 4 and is freely downloadable.
I meant binary packages, not a bootstrap tool chain.
- We can't wait for Lion, nor expect everyone to use Lion.
Xcode3 is still available. Xcode4 is not yet mandatory.
- Headers is a good point
It's an insurmountable obstacle, unless you plan on independently generating your own replacement headers (which is possible, but is going to be a world of pain).
- GCC is not the default /usr/bin/cc for Xcode4
Yes, Apple is investing heavily in moving everything to LLVM/clang in Lion (... and, as such, with Xcode4), but even in Xcode4 the default /usr/bin/gcc and iOS compiler is llvm-gcc4.2, not clang.
Additionally, you'll likely find it more difficult to track clang over GCC, as Apple is less explicitly about matching up their custom branches to actual releases as shipped with Xcode.
- Macports needs Xcode too.
My point was that this demonstrates why working with a vendor as capricious[1] as Apple often requires one to carve out their own niche of stable dependencies, and most of what you've often claimed sets homebrew apart[2] will be gradually worn away as you have to deal with Apple major releases.
That said, I hope MacPorts just starts using their support for binary packaging of ports (port archives).
[1] They're not really capricious, so much as focus on the consumer, and not on developers building large port systems. [2] I'm reminded of this line-by-line assessment: http://apps.ycombinator.com/item?id=872072
How is it unsurmountable? I remember mingw/cygwin doing a similar thing for Windows.
They'll be very incomplete, however, quite a bit of software will not build correctly, and it will take a significant effort to clean them up.
In light of this I am personally in favor of simply taking the binary pkgs out of the xcode dmg, in pursuit of maximum compatibility and minimum duping, and general adherence to homebrew's stated project goals.
However this would obviously require some research as to the specific licensing issues involved, and some dialog with apple. If it turns out to be OK, then the whole thing would be pretty trivial.
If it doesn't pan out, then look at messier options like using different builds, making your own headers (yuck) etc.
Until we can no longer access 3.2.6, let's not start spreading FUD.
If a problem is significant enough, the Community will figure something out.