260 points · by ingve · 10y ago · 250 comments
GCC could have provided a library that made it easy to do code generation or compiler development. That library could still have used the GPL, so that only Free Software could use it. Some of the work that has happened around LLVM wouldn't have happened around such a library, but some of it would have. (GCC has much more recently started down the "plugin" route, but too little too late.)
For instance, Swift might not have happened. But Rust may well have; a rustc compiler under GPL would not have broken anyone's ability to use it, any more than GCC's GPL prevents people from building proprietary software with it.
But instead, the GNU project chose to make it difficult to build any extension to GCC outside of GCC's own codebase. So instead of having an easy-to-use library provided by GCC under GPL, which might have furthered many of the GNU project's goals and encouraged more Free Software compiler development, they forced the development of an entirely separate compiler project to provide such a library. And the people who came along to do so, since they had to rewrite it anyway, chose to do so under a permissive license.
So, at least in hindsight, the Free Software world is worse off than it would have been had GCC provided a library infrastructure.
...but that never happened. Apple has tried to remove all GPL code from Mac OS. Where GPL code exists, it's only GPLv2 (like Bash; using an ancient version).
Even though all these companies are embracing opens source, they're embracing only permissive licenses. They're open sourcing the underlying tech stack while keeping all their offerings closed. If you're on Android, you are totally locked into Google services. I've met people who tried only using F-droid and running "open source phones" (minus the drivers of course). Their phones sucked. One of them switched back because she was tired of writing apps to do things she use to be able to do with the Play Store.
The dream of a GPL world where the software is free and you only pay for the hardware, is pretty much gone. We don't have federated systems, and where we do, no one uses them (GNU Social, Miro, Diasporia).
This isn't the open source world some of us envisioned back in the late 90s. I personally, will keep as much of my code under GNU GPL as I can.
First of all, "FSF's idea of open source"? They'd rather vigorously object to that phrasing. :)
But no, that was exactly my point: I'd argue that intentionally choosing to not allow the development of a library version of GCC, even under the GPL, caused a net reduction in the amount of Free Software in general, and copyleft-licensed Free Software in particular, that would otherwise have been developed.
To RMS, non-Free software isn't just worse than Free software, its a net harm to society such that it's better to have no software than to have non-Free software. Its even often (apparently, to RMS) better to have no additional software than to have a lot of additional Free Software and some additional non-Free software.
I feel like you are missing the point of the GNU GPL.
(I was going to go for the car example, but that is less and less true. We do not own our car anymore.)
So let's put it this way: The FSF didn't pivot when they had a chance to capture a larger market!
I'll bask in the downvotes that comes with telling the harsh truth. I got karma to burn, folks.
So although it hasn't succeeded for phones yet, building on top of tech stacks contributed by others (who haven't fully bought in to the same goals, but are sympathetic in some ways) still seems like a great strategy. The free software community needs to finish the job.
On the other hand, going fully independent and building stuff separately without those contributions (which seems to be what some free software folks want to do with commercial-unfriendly licenses) doesn't make a whole lot of sense to me. If you can't succeed even with substantial help, how do you succeed without help?
It's true that the Free Software federated systems that are more strongly based in ideology that bringing use-value to users have generally failed to experience uptake, but that should probably not be considered a surprise.
pity about the drivers though. at a speech in copenhagen stallman was encouraging people to start reverse engineer these.
it's nice that at least some of the phones are somehow open.
By creating a hard line, and building a compelling alternative to proprietary compilers, he introduced a seed of change in the minds of young programmers at that time .... All of whom are senior management now and share a belief that things like Protocol Buffers should be open source.
In fact, its interesting that Android is inducing this change all over again (not Linux). Its a viable answer to "its not as good as an iPhone,why should I buy it".
Now everybody cannot think of sofware as naturally different than propietary.
Hence giving an opportunity for a natural monopoly. Bill gates used security an argument a lot, and only became a little more secure by using permissive open source or buying software from poorer concurrent that had no good backup from their banks.
Bill gates is the baron de Beaumarchais of computers : whining about being riped of software he did not created because people would give the interpreter so that their code could be used.
A right on the second creation.
Just for the record Beaumarchais, whining for special treatment as an artist. He was a smuggler, a weapon dealer, a baron, an aristocrat, and a revolutionary AND he created the fundamental rights of authors.
The true fundation of liberalism: as long as it works for me, let's do revolution.
https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg00...
Fortunately, given that Graydon did prefer a permissive license for the compiler, LLVM provided exactly what he was looking for.
Might be hard at first and not very compatible with different compilers, but it is doable
Quick google search shows clang lagging gcc in all but one test[0] at least on Intel Broadwell. Again, what is the benefit other than permissiveness of the license?
[0] http://www.phoronix.com/scan.php?page=article&item=clang-gcc... This is almost a year old, though
- Clear and readable diagnostics -- especially useful when debugging nasty C++ template stuff where the type signature is a page long. (GCC is catching up in this area)
- Modular design -- if an IDE wants to have syntax highlighting or an Xcode/Eclipse/IntelliJ like "fix it" feature, they can use the clang frontend to parse the code. Also, GCC's "big ball of mud" design (iirc they do some optimizations like constant folding in the parser) makes it harder to hack on unless you're already pretty familiar with the codebase.
- Less hostile community -- people have tried to clean up GCC but their patches were rejected (see the RMS email link below)
- Helps you with standards compliance -- clang will still compile code with compiler-specific extensions but it has an option to output a warning. There are some codebases that have come to rely on these behaviors so clang's warnings can help make sure you don't end up tied to one specific compiler.
- Personally, I like AddressSanitizer (ASan). It does similar checks as Valgrind, but using compile-time instrumentation -- just pass in an additional flag. Gets rid of a dependency.
Having said that, I hack on LLVM daily and would not relish having to use GCC to the same effect. LLVM really does shine when used as a library!
[0]: https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html
egcs, on the other hand, was a much needed kick in performance and features of gcc, but had the negative of making it harder to maintain and understand.
lcc was a good example of moving back into the simple compiler design, but it seemed to have stayed more in academia.
No Cygwin/msys required -- it implements the Windows calling conventions, exception handling, etc. You can link modules compiled with Clang using the Microsoft linker.
gcc has had support for every operating system under the sun at one point or another - I fondly remember using the DJDelorie version for DOS+Extender, and if I'm not mistaken, there was also a release that could do WIN32 on Windows 95 from delorie.
I know a number of these issues have been improved/fixed in GCC over the last few years. Outside friendliness to internal tinkering and non-GPL software I'm not sure if one as serious technical superiority. I believe clang is written in C++ instead of C, for whatever that's worth.
GCC has always had a much bigger set of supported platforms and processors.
I've bookmarked this bit of GCC code for my own amusement - an anecdote about the quality of GCC's codebase:
https://github.com/gcc-mirror/gcc/blob/7057506456ba18f080679...
Especially with C/C++, there are a lot of potential attack vectors that would need to be closed (stack smashing, ROP, Vtable corruption). From a laymans perspective, some of these need full memory corruption protection.
Any references would be appreciated. The last time I had to adress CFI in C, static analysis (with greater precision than CLANG had) was involved.
It's not a full CFI, but my understanding is that it does completely prevent vtable corruption with ~5% overhead (measured for Chromium).
Also, I believe ASAN started with clang.
So while they may still be lagging in some areas, I'm confident they'll get ahead of GCC in those areas long before GCC catches up in the areas where it's behind.
Majority of Android phones out there are Qualcomm Snapdragon these days, and for the foreseeable future as they just inked an exclusive deal with Samsung. MediaTek SoC was already a proprietary nightmare of unreleased kernels and toolchains except for the leaked MT6589
The SoC manufacturers mess around with proprietary peripherals and obstructive boot processes, but haven't messed with the actual instruction set.
LLVM is designed to be modularized and embedded in other binaries and toolchains, which makes it easier to build extensions and tooling around it.
In addition to having a mountain of legacy code, gcc's project steering is philosophically opposed to allowing non-free (as in GPL) plugins [https://lwn.net/Articles/582242/]. Because of this, developers looking for the most flexible toolchain seem to be backing slowly toward the exist regarding gcc, as the Clang / LLVM steering team has made clear that they don't see similar incompatibilities between their tool and the way developers choose to use it.
There is a project going on to break the gcc down into components [https://gcc.gnu.org/wiki/rearch], so time will tell what comes of these two toolchains.
I think that's the right philosophy. Why shouldn't you be contributing your plugin if you derive value from it, so that other people can derive value from it just as you did with GCC (if you distribute it that is - if you wrote it inhouse for internal use, then it doesn't matter at all!).
It's not like the code generated by GCC is licensed virally.
It's a shame that GCC's code is hard to modify, and difficult to extend. LLVM's permissive license means that contributions don't flow back unless it's favourable to the entity contributing it (such as good PR). I imagine that if somebody/some company wrote an excellent, non-obvious, non-trivial toolchain using LLVM, derive profit from it, they will not _want_ to contribute it back.
Richard Stallman reasoned that by exposing an interface to other applications, or allowing other applications to access or modify intermediate code/trees, closed source proprietary applications could be built around GCC.
He was probably right ... but we all ended up with a worse compiler.
Last time I checked gcc binaries beat Clang performance wise.
Several extension mechanisms have been built out in the last few years, including plugins for intermediate passes of compilation, and a library to operate as a JIT.
Eddyit: Spelshing.
B) If you ever want to make a change to the toolchain, HARD SWERVE on supporting GCC. It's a liability if you need to modify it at all. This may have more to do with what Google wants to support rather than any effect on the end user.
What's the point in being "modular", if you can't add a backend nor a frontend without having to clone-and-modify the whole LLVM tree? (And what if I want to compile Rust to Javascript? Which of these incompatible LLVM branches should I use?)
Rust maintains the fork because in the foreseeable future, there will be non-blocking bug fixes and Rust will not follow LLVM trunk to get them.
Also, I would mock you for using <iostream> at all but you've probably got legacy code just the same as I do.
From the link: "Also note that Clang packaged in the Windows 64 NDK is actually 32-bit."
At least on windows, it is FOSS with a complete SDK for Win64.
Clang requires the Windows/Platform SDK. You cannot really use it without it. You cannot create a distribution without it.
The NCSA license explicitly allows sublicensing, so both the GNU project and Microsoft can create derivatives under free and proprietary licenses respectively, for example.
[I am not a lawyer, but this is the reasoning of the accepted answer to a stackexchange question applied to the NCSA license: http://programmers.stackexchange.com/questions/105912/can-yo...]
Woohoo!
I am annoyed by the FSF dogma because they lay an exclusive claim on the word ethics when applied to software. I consider myself an ethical person even in software. But my definition of ethical is less strict than the RMS definition.
I'm not sure that's a fair characterization. They've defined an ethical framework for software and then they discuss things being ethical or not within that framework.
Anyone is free to use a different ethical framework and decide if an action is ethical or not within that framework instead.
Probably because it's not software.
We're already very close to that world. Many people seem happy to see GNU losing ground every day. For myself, I am not sure that we are working towards the best possible future, but I'm not even sure what that future should be.
Maybe GNU is just a stop-gap movement to get everyone on board the FOSS train, who knows. BSD licensing hasn't caused any apocalypse yet and arguably it provided a networking stack for Windows that was superior to anything MS could rush out the door back in the NT 3.5 days. There's something nice about being able to put the code into commercial products without worrying about strict GNU/GPL-like conditions.
If most people defaulted to sharing code like was done pre-Microsoft then BSD would be fine. Read RMS's rant that is linked above. He's still at defending against "adversaries" of Freedom. This is war!
OK, so even MS is now open sourcing (some of) their code. Maybe it's not "war" anymore, but you need to understand the history a little.
This is why rms is the way he is. He's old. He remembers the days when all software was free. He's been trying to get that back ever since.
It is hard to see the entire impact of Free software and even harder to predict how the world would like if people actually stood up to it but I can say that I am sure we would have:
- more secure Internet - more decentralized/distributed Internet - no ISP blocks - much harder if not even impossible NSA spying - no disgusting DRM - no patents and patent trolls -> more inovation - no force updates, no abandoned users - more competition in hardware and software field - things being developed for people and not sheer profit - ... - add your points
A lot of hard problems come from the fact that you need lots of developer attention to build and maintain solutions that just work. The domain is tricky and complex enough to where, you can make it zero-effort for one configuration, but making it zero-effort for all possible or even all likely configurations takes more resources than is available.
The example relevant here is cryptography software. It's not hard to encrypt stuff. It's hard to make end-to-end solutions that just work, for all possible uses and across all possible platforms.
Free software has a restrictive effect of only making software platforms that are open and extensible, vastly reducing the effort needed to maintain end-to-end, user-friendly encryption.
It would make it pretty much impossible for the NSA to spy on citizens if we only had free software platforms to support.
> If you have problems with Clang, please file bugs!
Filing compiler bugs is really hard with a closed source project.
God saves a puppy anytime someone filed a compiler bug with a trivial test case that demonstrates the problem.
The current (r10e) shipping version of clang cannot return 128bit floats from a function.
#include <iostream>
int main(int c, char **v) {
std::stringstream("1.5");
double x; s >> x;
return x == 1.5 ? 0 : 1;
}
EDIT: You don't need "long double" in the above. double (or float) will show the problem. The standard library converts all floating point numbers to long double internally.I see mention of long double in your edit, but even then wasn't that 80bit on PC architecture. Only Solaris and HP-UX? defined that as 128bit.
#include <iostream>
#include <sstream>
int main(int c, char **v) {
std::stringstream s("1.5");
double x; s >> x;
return x == 1.5 ? 0 : 1;
}
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posixI wonder if the bug you are seeing is a result of the C++ STL and not the compiler itself. Can you try reproing with libc++?
In any event, you can file bugs here: https://code.google.com/p/android/issues/list?q=label:Compon...
""" We’ve moved our bug tracker to GitHub: https://github.com/android-ndk/ndk/issues """