134 points · by wslh · 13y ago · 159 comments
In fact, the error messages of the two systems are largely a tradeoff at this point, and in a project I work on that compiles using both gcc and clang (targeting MinGW and OSX) simultaneously, on multiple occasions gcc has returned the more useful error messages (even if you discount the times when clang outright crashes while trying to compile my code, something gcc hasn't done to me in a decade). Even to the extent to which clang is better (which is mostly how it will guess what you meant and then compile the rest of the file under that assumption), it is kind of insulting in an open source context to treat that as a competitive advantage when I'm certain gcc would have loved that patch as a contribution.
This. As stated in the accepted answer in the linked article, licensing issues are the real reason. Technical differences are ephemeral. The competition between GCC and LLVM has a habit of inducing improvments in both projects. By all means, at any given point in time one project can have an edge over another in this niche or that edge case. But fundamentally this is a philosophical divide between Free Software and Open Source Software.
GCC uses a copyleft license; LLVM/clang uses an all-permissive license. FreeBSD prefers to avoid dependencies on copyleft code, especially in their core; thus, they naturally prefer LLVM/clang.
Personally I'd call it a divide between "Free" Software and Free Software. The GPL's style of bringing freedom to the world reminds me of Operation Iraqi Freedom...
Then what's the difference between the two terms?
I've always thought that they were quite different (RMS vs ESR). Especially when capitalized as pronouns.
Edit: Nevermind. I missed ajross's response.
Hardly the case when you want to extend/embed your compiler frontend/backend. In this case, LLVM/Clang shine. They are written in fairly clean and comprehensible C++ libraries. Most CLI tools are well under 1k lines! GCC is a real pain to even comprehend, let alone extend/embed!
If you think this is good/bad for Clang/GCC, depend if you ever used said features, or if one prefer a smaller compiler which has less features.
I heard GCC is partly a bit of a hairball to prevent GPL loopholes. They wanted to ensure you can't wrap it in some kind of RPC framework to get around the GNU GPL. They might clean things up a bit, if there's no longer an incentive for people to want to effectively steal it (since they can just use Clang instead).
In fact, open source projects (even GLP ones) might start switching to Clang, if it has a cleaner API.
So the costs of a hairy API are going to start outweighing the benefits.
Even if it that doesn't hold true anymore, I think it's valid to highlight since it's one of the motivations, probably one of the original creators' pain points with GCC.
The website reads:
Some of the goals for the project include the following:
End-User Features:
- Expressive diagnostics (examples)The sales catchphrase superior error message is still true for the people in the market. And comparison with compiler in GPLv3 is meaningless to them.
You're just out of target.
This is the latest version available by default on MacOS and FreeBSD (for licensing reasons; subsequent versions are GPLv3), the two operating systems where clang sees most use.
Ultimately, clang offers a way forward without having to adopt GPLv3 software, and besides that offers considerable benefit to people making development tools. Its big selling point has never really been speed; that it can generally keep up is enough.
EDIT: You could certainly also make the claim that Clang's far faster compilation is a technical feature, especially for C++ programmers. There are actually people who use clang for development, for the fast compilation and static analysis, then build for production with a newish GCC.
[1] http://www.phoronix.com/scan.php?page=article&item=llvm_33sv...
talks about the experience provided by the command line compiler, contrasting
-Clang output to GCC 4.2's output in several examples.
+Clang output to that of GCC 4.2 (current when the Clang project began)
+in several examples.
<!--It seems reasonable for FreeBSD to favour BSD licensing.
EDIT Ah, I see how: you're talking about clang's website, whereas I'm talking about the submitted link, which is about FreeBSD. Note: the same argument also applies to other companies avoiding the GPLv3, which would explain why clang's website uses gcc 4.2 in its comparison. Though people here mentioned the GPLv3, no one noted that 4.2 was when the gcc license switched to it (I checked the HN comments).
FWIW I've seen a GPL project eventually lose out to a BSD-style competitor, and the latter were surprisingly nasty about it, similar to what you're saying. This might be due to commercial interests vigorously supporting the BSD-style version for reasons of MONEY. But apart from nastiness, it makes sense that a more permissive license, being free to a wider audience, will be more popular. OTOH perhaps here, for a compiler, requiring people to give back (GPL) will work better? OTOH2, promising new tech always gets a certain ersatz caché - whether that promise is fulfilled or not.
gcc is still better at optimization, though. For now.
[edit: wow, people are really confused here. Guys, LLVM was designed from the start to have a clean separation between passes. You can compile some other language to the LLVM bytecode and then just use the code generator, for example. It even includes a JIT! In contrast, gcc is a huge monolith. The projects are written in different languages, too... C++ versus C.
tl;dr is that when you say that "the only difference is the license," you sound like someone saying "the only difference between Ruby and Java is the file extension." Pointy haired.]
gcc has been becoming more modular over previous releases, and is becoming more modular in the future. For example, there are plugins since 2010.
Your information is outdated, so it makes your opinion seem uninformed.
I work with some fairly recent version of both compilers-- gcc 4.7.2 and clang 3.2. I also know a developer on the LLVM team. clang is way ahead of gcc in many ways, and the gcc devs know it.
We still ship software built with gcc, rather than clang, because gcc is still better at optimization. (gcc also supports more obscure targets, though that's not our biggest concern).
We also make use of llvm's ability to dynamically recompile code on the fly in Cloudera Impala. More information here: http://blog.cloudera.com/blog/2013/02/inside-cloudera-impala...
This would not be possible with gcc no matter how much work we did (license issues-- Impala is Apache 2.0, gcc is GPLv3).
As a result, gcc is substantially harder to understand and work on than other compilers of similar scope.
As a result, new development effort, both personal and corporate, is going into clang.
As a result, even if clang is only approximately at parity with gcc now, people expect it to improve faster in future, and therefore to be a better choice now.
All of these contribute to what http://lists.freebsd.org/pipermail/freebsd-questions/2012-Ju... says are non-licence reasons to replace gcc:
1) GCC's continuously increasing propensity to generate "bad code",
2) The inability of GCC mamintainers to fix _long-standing_ bugs, some
have been identified for over a decade, and have not been fixed.
3) The continuously increasing trend of introducing 'non standard' features,
4) The growing need to 'write around' correct/valid code that GCC will not
compile.
5) The fact that the GCC code is 'unmaintainable' -- *NO*ONE* (other than
someone who has been working with GCC internals for "forever" --a decade
at an absolute minimum) has any chance of 'understanding' what it is
doing internally.GCC plugin needs to be GPL-compatible, and GCC includes a license check similar to Linux kernel module tainting. (Instead of tainting, you can't run plugin at all.) http://gcc.gnu.org/onlinedocs/gccint/Plugin-API.html
Case in point: their SMB stack.
To me this shows that Apple would just not have used (and contributed to) any free software if it was all GPL3. The world would be a worse place. In fact, the world has gotten considerably worse, Apple-wise, when we lost Samba in OSX.
The patent clauses in GPL3 make that license completely unsuitable for any company (with cautious lawyers) that owns significant patents. I can really kind if understand Apple here.
The only significant change that FSF did was adding an additional point regarding patent agreements. They describe that: If you have an expressed permission to practice a patent or covenant not to sue for patent infringement, such agreement is seen as identical as if you were holding the patent yourself.
If you are in a company that has significant amount of patents, and who would prefer keeping a patent rather than gaining benefit from free and open source software, then one need to keep an eye on any software one want to distribute that has apache, GPL or any other licenses with a patent clause in them.
If you are in a company that has significant amount of patent agreements, then one need to keep an eye on any software one want to distribute that got GPLv3 software in it. Apple do have a few such agreements.
What he has said is that he personally don't like DRM, but he thinks it outside the scope of the kernel and a software license (see https://groups.google.com/forum/#!topic/fa.linux.kernel/L5NR...)
The *BSDs prefer a non-GPL licensed alternative if they can get one.
Also, as noted in the comments on StackExchange, BSD licensing vs GPL may be reason enough to discontinue the use of gcc in FreeBSD systems.
Any new C compiler has to either just be a C -> optimised C compiler (in which case why not just write an LLVM pass) or duplicate all of the optimisations which exist in LLVM/gcc.
In other words, FreeBSD ships with a gcc binary, which means FreeBSD is distributing gcc, which means all clauses in the GPLv3 apply to them.
Any group/company/whatever wishing to ship FreeBSD that doesn't strip out the compiler will be affected similarly.
Sylvestre Ledru spent some time on this in particular in his talk at this past FOSDEM[1], taking the above as evidence that clang is now mature enough to support the Debian archive.
[1] https://archive.fosdem.org/2013/schedule/event/debian_clang/
Clang doesn't need to be a drop-in replacement and I think it shouldn't be, but let the buyers beware.
I think having multiple different interpretations of undefined behavior a good thing. Means new standards could likely define it. Also shows how much code manages to compile that probably shouldn't. I know i've been surprised with what ambiguous stuff gcc has allowed in my own code.
Any C or C++ developer doing cross platform development, even if only across UNIX platforms, will have lots of war stories to tell about using different compiler vendors across systems.
Given what happened in the financial markets as they were deregulated I am extremely suspicious of the notion that removing the constraints of Copy Left will actually be positive in the long run. I have no doubt that it will help companies like Apple but I don't see the benefit for the wider community of developers.
If someone wanted to be a dick about it they could release modified GPL code as one big diff and publish it on some obscure webpage only their customers have access to. Instead we see more and more companies and individuals becoming friendly open source citizens. Perhaps some because the GPL mandates it but I would like to think mainly because they feel it's right thing to do—copyleft or not.
Of course, people can use whatever license they want. I personally favor licenses that maximize the rights of my users. Hopefully, though, you can now see that the combination of positions you mentioned is a consistent one.
Your statement is a shining example of the fallacy fallacy though... just because one interpretation of what I said on a detail of it is incorrect, that in no way invalidates my statement nor the existence of vocal people like those I describe.
That seems pretty in step with the GPL.
I misread this at first. I think this makes the point more cogent:
the same people who get up in arms about government, and bitch and moan about "rights to the fruit of my labor", don't like the notion that someone can claim "the rights to the fruit of their" labor by putting a gnu license on something
#2 Hosting/cloudiness?
#3 Administration?
#4 Custom adaptation?
#5 Privileged early access to updates/content files?
All those different strategies has been used to "sell" GPL software. Even the last one has been used, even if their customers could repackage the update and redistribute it to non-paying customers.
The possibility of a dual licence gives the creator a compensation because he waives the rights the GPL gives him for you.
Also: Support contracts. A lot of poeple live in the support ecosystem and adapt GPL/BSD software for costumers.
What you shouldn't do is to hope that anyone will pay you.
The first person who pays can offer exactly the same thing for $0.
It's impossible to convince anyone that they should pay you even $1 if exactly the same thing is available for $0 from somewhere else.
The ability to charge for GPL software is purely theoretical. In practice, you can't.
Apple has made more money form free software than anyone else, and they can pressure FreeBSD to stay away from GPL3
Yes; Apple can pressure the FreeBSD project to stay away from GPLv3, through their evil Apple magic. In fact, they are presumably pressuring the whole world to stay away from GPLv3, as it has seen almost no adoption outside the FSF! Naughty, naughty Apple. If not for mean ol' Apple, the FreeBSD project would no doubt rush to embrace GPLv3, discarding their horrible old BSD license!