169 points · by espadrine · 12y ago · 159 comments
* Modern modular design (everything is libraries) * Faster compile times * Nicer error messages
The modular design in particular is a good reason that might not be obvious at first. It lets you do things like debuggers, code formatters and static analysers in a much more sane and robust way than GCC's "no plugins, everything must be separate and flaky" way.
[1] (similar talk) https://www.youtube.com/watch?v=mVbDzTM21BQ
the 3 giants are working together...
Even GCC developers (like I was ) don't really question it.
The only thing GCC buys you right now, at all, is slightly better performance (it varies depending on your benchmark) and support for a larger variety of odd embedded systems.
On the other hand, LLVM is very easy to modify, can be built as a library (as can clang), has a sane, well defined IR, etc.
But sometimes I wonder if the license doesn't play a role as well.
Of course, given the source, apply salt :-).
The last time I checked gcc still had better performance than CLang, but things might have changed since then.
2. LLVM is a lot easier to improve.
> With the switch to clang, binary size dropped about 8% while performance mostly stayed the same. Startup time improved a bit,
Also I can imagine it might be nice to use the same compiler on different OSes, and gcc is very much a 2nd class citizen on mac.
You can now build a fairly well-functioning chrome binary, from visual studio, with clang/llvm, without source code changes.
- Useful warnings, they look good, and are on by default.
- More than a compiler, lets you build your own tools (example: AddressSanitizer)
- Better performance (less time) with clang vs. gcc for both -O0 -g and -O2 (at the time the benchmark was done on 8 cores, 24GB)
In summary / tl;dr : they enjoy diagnostics, the clang code base, how it works, and the ability to write their own tools. It seems like it's more to do with preference/performance and less to do with licensing. I'm sure that now they're doing many more things with clang since three years has passed since the aforementioned talk.
Which either defaults to using clang or gcc.
Over time, using Clang effectively will require proprietary modules from Google, Apple, et all and the GCC project, long dead, will haunt us from the grave.
We'll tell stories to our children about how when we started learning to program, it was easy to get started because compilers were free, but now the only free compilers are toys, ill-suited for anything but the most basic education.
A special thanks to everyone who helped make this possible by attacking GCC and championing LLVM whenever possible. I hope it's very, very easy for you to write extra modules for your new proprietary compiler.
http://llvm.org/docs/DeveloperPolicy.html#license
To others: I presume what the parent comment is complaining about is that companies are legally allowed to modify the llvm source and distribute those binaries without source code.
This is not a bad thing, unless you're an open source zealot.
From the URL above:
> We intend to keep LLVM perpetually open source and to use a liberal open source license.
and
> We believe this fosters the widest adoption of LLVM because it allows commercial products to be derived from LLVM with few restrictions and without a requirement for making any derived works also open source (i.e. LLVM’s license is not a “copyleft” license like the GPL).
This is reasonable.
They have also traded away a way to encourage others to keep it open in return for wider adoption.
Interpret that as you will.
It's always fun to see people being more papist than the pope, though.
s/encourage/force/
If you have to force people to do what you want, who cares. Leading is about getting people to go in a direction they may not want to go. Not pushing them off a cliff.
Many of us read the site always in this manner. While arguably this post (and a small but significant minority of others) are false positives, I find that most of the [flagkilled] posts are removed for good reason. The current system has flaws, but is not "complete nonsense".
Google literally upstreams everything we produce for llvm/clang.
We did the same for GCC, including things we could have kept to ourselves, like LIPO (https://gcc.gnu.org/wiki/LightweightIpo)
I have a lot of trouble coming up with a case where we wouldn't upstream something. Do you have any evidence for your concern, based on history, or is it all random hyperbole?
As both a GCC and LLVM developer, i can tell you that GCC lost entirely of its own accord.
PS it's somewhat ironic that Google contributed a lot to GCC, and you complain about it and assert they have poor motives because they decided to move to a different technical solution, yet from what i can tell looking at changelogs, you have never contributed to either GCC or LLVM. If you want the world to turn out the way you want it, you actually have to participate.
Personally, I see something as big as Chrome moving to LLVM as a late-stage indicator of the mass adoption of the platform. I'm young, as you've pointed out, and I've never worked for Google, but I'd bet that this decision wasn't made lightly, and it certainly wasn't made early in the lifetime of clang/LLVM.
The people truly at fault for the things I fear, should they come to pass at all, are not the late adopters like Google, but the innovators who decided to put their energy into LLVM, knowing full well how dangerous it could be.
I don't and didn't mean to imply that Google is going to stop contributing, or that Google never has.
I do think that Google's decisions to contribute upstream are based on business sense, as opposed to morality, and I think that should the day come that it makes business sense for Google to not contribute back, or to release a non-free fork, it'll do that. As others in this subthread have pointed out, Apple has already distributed non-free LLVM modules.
The concern I have is that this is possible with LLVM, and it was not possible with GCC. When Apple wrote a non-free Objective-C frontend for GCC, they liberated it because the Free Software Foundation successfully enforced the GPL. There is no legal mechanism to force corporations to contribute back to LLVM, so they do it of their own goodwill, if they do it at all.
I think this is dangerous because it can lead to a world where there are no good free compilers. The people who wrote LLVM, the people who championed it early on and contributed to it, they could have realized this too, and they did nothing to stop it. I truly hope they acted the way they did because I am egregiously wrong, and that nothing I'm afraid of will ever happen.
To put things in perspective, GCC had one fork in its history already. I think that if it was forked again, redesigned extensively to make it easier to get parse trees and add modules and so on, with the legal requirement that all such modules be free in any distributed compiler, the FSF would eventually, hopefully, accept that as the canonical GCC. It would have been harder to do that than to make LLVM, maybe it would have cost the world a few years of compilers research, but it would have been possible, and it would have made for a more secure outcome.
You are talking about things that people have been working towards for years. The people you see working on it now have been working on it since almost the beginning of LLVM.
Google is the company that put their energy into LLVM, knowing how dangerous it may turn out. But you don't have to take my word for it, check the commit logs.
Just because we didn't make a public pronouncement and try to get press for it doesn't mean it didn't happen.
"I do think that Google's decisions to contribute upstream are based on business sense, as opposed to morality, "
Then i'll just say you don't understand me or the folks that work for me.
"The concern I have is that this is possible with LLVM, and it was not possible with GCC."
It is in fact, possible with GCC, despite your claims. In fact, all you would have to do is change the C and C++ runtime libraries (which is entirely doable nowadays). That's it. The FSF knows you can interpose stuff legally as well.
" with the legal requirement that all such modules be free in any distributed compiler,"
It is probably not possible to make such a license and have it compatible with various GPL versions, etc.
"hopefully, accept that as the canonical GCC."
You also seriously misread what would have occurred in this situation. People tried what you are suggesting. RMS said no for many years, right up until the point it was probably too late.
Forking again was considered, by all the companies and people involved. But it wasn't worth it to any of them to have to have political fights with the FSF over software development every couple years, when they just want to get shit done.
Except for the part where that it was literally said, yeah, ...
"He is not attacking Google and there is no reason to take it "personally" and entering to the "defensive mode" immediately."
Google was specifically called out as "sure to require you to use proprietary modules".I don't know how you can read it any other way.
We have never done so in the 10+ years of working on GCC or LLVM.
It's no more valid than me saying "Linus doesn't want to use GPLv3 because he wants to release consumer devices with the kernel and proprietary modules on it". IE it's complete unfounded bullshit with not a shred of intent or data to back it up, and goes completely contrary to the history of his work on the project.
In any case, we have no plans to release proprietary modules for clang/llvm.
That's not to say it destroys freedom, but its not ideal for a certain subset of software. The GPL is also not magical in this regard, since you have projects where things don't get up streamed.
Cost. If your advantage was perpetual and didn't increase your future support costs, then sure, you wouldn't contribute it back (ignoring belief / culture).
It isn't though. Someone will do something similar and even if they don't, each new version requires you to not upgrade or spend the time integrating your wonder code into the mainline again.
Long term cost of staying current is going to be an issue. Each change to your fork makes bringing in new features from the original harder.
Plus, in my mind, it is a nice self selected pre-screening filter for companies / individuals that would be good to work with.
There have been issues with GCC for over a decade that go unfixed and unchanged because it doesn't make the most business sense to contribute to it. In the category of interoperation in particular, the GCC project proved to be openly hostile to the notion; they left a wide gap in the market for Clang/LLVM to fill.
Which they achieved at the cost of correctness: https://code.google.com/p/android/issues/detail?id=58726#c10
And vendors do contribute performance patches back to AOSP. ARM's Linaro group has updated & NEON-enabled some libraries, Intel contributed SSE optimizations and x86 support in general, Nvidia contributed NEON optimizations, Imgtec for MIPS support, etc...
There's a cost to maintaining a downstream fork, and a slight competitive edge tends to not actually be significant enough to justify the engineering cost.
For instance Apple came out with A8X which I am sure required special clang codegen optimizations - where is that code? If that continues to sit behind Apple's closed walls then it's already proving OP's point.
But it's not an argument against clang, which remains a high quality free software compiler and one worth using. And citing the existence of said free software as evidence for the "end" of free compilers seems... weird.
Well, one could argue that clang and its license are inseparable and if the license enables the reality that more and more higher quality stuff remains proprietary and that the source-available clang version remains a step child or second class citizen then your "high quality free software compiler" point becomes at least partially invalid.
If on the other hand GCC's license means more companies contributed in the open and only a single first class product remained equally available to everyone then GCC ended up being a better product than clang.
But worse than that, proprietary modules can be mixed-in to Clang and LLVM. So essential functionality can be hidden in proprietary modules. Imagine that Apple wants to do something nifty for Swift, but doesn't want Google to be able to use it in Go -- they'll release a proprietary module that can be linked into Clang.
All free code in LLVM can be forked and made proprietary, and no proprietary code can be reasonably expected to be liberated. So the balance of free to non-free code can only ever get worse.
I'm sure that the libre software world being based on a proprietary compile will be a great thing to add into the mix of pervasive surveillance and network penetration.
By your definition, any non-copyleft open source licensed software ceases to be open source 'in the broadest sense' once a proprietary fork exists. Which is just silly, some software is open source according to the open source definition or it is not.
Imagine that Apple wants to do something nifty for Swift, but doesn't want Google to be able to use it in Go -- they'll release a proprietary module that can be linked into Clang.
People who pick the Apache, MIT, or any non-copyleft open source license do this knowing that proprietary forks or extensions are possible. Not everyone's definition of 'freedom' is the same as the FSF.
Also, I would like to point out that the same thing happens in copyleft-land. Companies dual-license their code under a proprietary license and let contributors sign agreements, to shut out competitors and to get people to buy expensive proprietary licenses. Oracle thankfully uses the GPL for such strategies. In fact, they recently relicensed Berkeley DB and Berkeley DB XML under the AGPL(!).
I'm sure that the libre software world being based on a proprietary compile will be a great thing to add into the mix of pervasive surveillance and network penetration.
Just help me understand. FreeBSD takes the open source LLVM/clang, uses it to compile their open source software. And suddenly it becomes proprietary. How so?
This is also true of GCC. Lots of organisations have private forks and the GPL allows that. More generally, if somebody offers 'compiler as a service' over the internet then the GPL becomes irrelevant and they could add as much private code to GCC as they wanted. The GPL only forces you to contribute back under a very specific and narrow set of criteria. Criteria that the majority of software being written in 2014 doesn't meet. The GPL is largely irrelevant to most software shops these days - they freely incorporate piles of GPL licensed code into proprietary closed source products. They can do so because most new software is internal to organisations or delivered as an internet service. The GPL was designed for a different world.
Software freedom has been set back because of people clinging to the GPL as the final word in software freedom. Your kind of GPL centric propaganda results in young developers today thinking they are doing the world a favour by writing proprietary closed source web apps - because they are using FOSS GPL libraries, right? And targeting the 'open' web, right?
Do you AGPL licence all the code you write, including website backends? Does your employer? If not you should probably take a close look at yourself and consider that maybe you are part of the 'problem' you are decrying.
This would be true if people could not and did not write new free LLVM code/modules...
Proprietary forks and modules of GCC exist too. Shocking, I know.
Both projects are politically motivated. GCC began explicitly as a project to provide a FOSS C compiler (few if any existed at the time). Clang/LLVM didn't start at Apple, but their development has been heavily sponsored by Apple, whose interest in the project stems from their interest in excising the GPL (and specifically the GPLv3) from their entire development stack. (Notice how the version of bash that ships with OS X is almost a decade old, and is also the last version that was released under GPLv2).
The fact that Clang/LLVM are released under a FOSS license today does not mean (A) that they always will be, or (B) all essential functionality will always be[0]. With GCC, being a FOSS compiler collection is their entire raison d'etre - it's right in the name![1]
Edit: Reworded sentence to remove ambiguous antecedent.
[0] (ie, it's conceivable in the future that nobody will want to use Clang/GCC on its own, but will essentially have to use it in conjunction with another piece of related software, and there's no guarantee that this software will be FOSS. With GCC this is not a relevant concern only because the FSF would never let that happen; it undermines the entire founding point of the project.
[1] GNU Compiler Collection
clang was designed to do that from the start, and for me this has lead to greatly improved C++ tools.
[1] http://www.imore.com/debug-48-melton-ganatra-episode-ii-unde...
Apple wanted to integrate the compiler more deeply into their IDE, Xcode. GCC didn't allow that without making Xcode GPL too - which was out of the question. Apple has no problems contributing changes back to GCC or clang -- but there is no way they will make XCode open source.
Clang allowed Apple to take their IDE to a whole new level. Since the move to clang, features like code completion, scope higlighting, refactoring tools and inline error display (with somewhat helpful autocorrect suggestions) have vastly improved.
Apple didn't want to get rid of GCC out of spite, butthe restrictions of the GPL were holding them back. If you are a supporter of copyleft licenses, you'll see this as a success (hindering proprietory software), but from Apple's perspective it is obvious why they chose to support a compiler with a more liberal license.
This is not accurate in any respect. It would be accurate if you said "early development" (original development was sponsored by UIUC).
Their interest in the project was not at all in excising the GPL. They didn't care. That was a political position they took once on a GCC mailing list. But lawyers do not run Apple. If they wanted to keep using GCC, they would have kept using GCC.
They wanted faster build times, a better infrastructure, and something they felt they could invest in and not have this amazing uncertainty about where it was going and what it's goals were. They also didn't want to have engineering stymied by the politics of GCC (it is less political now, it was very political then).
Or it could be a frontend for a new proprietary language.
Or a backend for a whole new architecture.
The versions of Clang and LLVM that you have today will ALWAYS be available under the license they're currently under.
You're fear-mongering that the current contributors of Clang and LLVM may, in the future, make new releases under licenses you don't like.
But if people like Clang and LLVM, they can fork the current code, and keep adding features to it under a compatible FOSS license.
I view the flamewarz between BSDish and GPLvX licenses as similar in spirit to the arguments between laissez faire capitalism and northern European social capitalism.
Also, I don't want to force my ideology (I find FLOSS preferable) on other people, while still giving my software away. However, technical reasons such as the above were 50% of my license choice.
Given the vagueness of the GPL, I can fully understand that many companies do not want to deal with that, even if they want to contribute to FLOSS in some way.
I disagree - the definition of software being free to modify and redistribute doesn't change based on the intent of the modifier.
There are more restrictions on your freedom to do these things under GPLvX than under Apache/etc.
A software author chooses which license based on the desire to encourage societal interests or individual interests, but the underlying meaning of 'free' remains constant.
The Clang/LLVM license is both a free license as defined by the FSF and an open source license as defined by the OSI[1].
[1] https://en.wikipedia.org/wiki/University_of_Illinois/NCSA_Op...
People who use Copyleft licenses want the users of the software to have freedom. People who use permissive licenses want the developers of the software to have freedom.
GPL: "heres <product>, do whatever you want with it as long as you make all your changes public, oh and theres a ton of rules you need to conform to if you want to distribute <product> with <other_product>"
I don't see how a license with MORE restrictions can be seen as free-er.