FreeBSD Throws the Clang/LLVM Switch: Future Releases Use LLVM 360
An anonymous reader writes "Brooks Davis has announced that the FreeBSD Project has now officially switched to Clang/LLVM as C/C++ compiler. This follows several years of preparation, feeding back improvements to the Clang and LLVM source code bases, and nightly builds of FreeBSD using LLVM over two years. Future snapshots and all major FreeBSD releases will ship compiled with LLVM by default!"
Re:Why switch at all? (Score:1, Informative)
Never really understood the motivation for switching away from GCC. Please enlighten me.
being bsd people, they don't like the gpl.
Not GPL, and suitable for JIT (Score:5, Informative)
Re:What's the clear advantage of LLVM? (Score:5, Informative)
The reason FreeBSD switches to clang/LLVM is the license: BSD instead of GPLv3.
You should give clang a try. The LLVM has a much cleaner api then gcc and the error message's are also more readeable. In terms of speed, the difference is shrinking with each release.
Re:What's the clear advantage of LLVM? (Score:5, Informative)
I know of LLVM, but haven't used it, and it really seems like very few hardcore Linux/OSS devs have a clue about it. Is there really a clear advantage, or is it just an excuse to write a new compiler to solve a problem that doesn't exist?
The actual reason, from what I remember, is licensing. They want to build a fully BSD-licensed OS from the ground up, with zero dependence on GPL-licensed stuff.
Re:Grin (Score:1, Informative)
For us non-BSD muggles, please explain why.
Basic alphabet fetish. After all, "BSD", the abbreviation for "Berkeley Software Distribution", is more letters than the abbreviation for "Linux", which would just be "L". Thus, it only follows that "LLVM" appeals to him more than the simple "GCC", which is only three letters, and thus old and stupid.
Re:Grin (Score:5, Informative)
This explains it well: http://unix.stackexchange.com/a/49970/7345
Re:Grin (Score:5, Informative)
Generally a lot of BSD users don't like the GPL, and getting rid of a GPLed compiler makes them quite happy.
Also, although I've heard a lot about the inner workings of GCC being rather intertwined and convoluted, whereas LLVM is simpler to work with and modify (not sure how true this is).
Re:Why switch at all? (Score:5, Informative)
Could check this article: http://clang.llvm.org/comparison.html [llvm.org]
Apple made the switch a while back in Xcode. The end result was much better debugging and refactoring capabilities.
Re:Not GPL, and suitable for JIT (Score:5, Informative)
For example, we wouldn't have an Objective C compiler if NeXT hadn't been forced to release it in order to comply with the GPL.
Speaking as the person who wrote and maintains the GNUstep libobjc and the clang support for it: Bullshit. The GPL forced NeXT to open source half of the implementation (the compiler support, not the runtime), and their implementation was such a pile of crap that it set back GCC's support for a long time. Open source support for Objective-C in clang is so much better than in GCC that it's not even worth comparing the two.
Re:WOW (Score:4, Informative)
Most likely the BSD maintainers and developers out there.... bout thats less then 0.00001% of 7+billion people. I'm going to guess anywhere between 1-1000 =)
Now add in all the Mac and iOS developers and the number increases just slightly. MacOS X 10.8 is completely built using Clang + LLVM. OpenGL uses LLVM. OpenCL uses LLVM.
Re:What's the clear advantage of LLVM? (Score:3, Informative)
Clang is in the order of 10 times faster than GCC (compilation speed) and the generated binary is 1% faster than GCC (so essentially the same but saves hours of compile-time per day on 50MB+ C-files).
Bullshit. It's compilation is at most 1/3 faster, and on most cases I checked, the result executes between 5-25% slower. The former seems to be pretty constant everywhere, the latter strongly depends on the code base in question, with huge outliers both ways.
Re:Grin (Score:5, Informative)
is there a reason for not making the front ends dynamic libraries which could be linked by any program that wants to parse source code?
Quoth the Stallman himself:
One of our main goals for GCC is to prevent any parts of it from being used together with non-free software. Thus, we have deliberately avoided many things that might possibly have the effect of facilitating such usage, even if that consequence wasn't a certainty. We're looking for new methods now to try to prevent this, and the outcome of this search would be very important in our decision of what to do.
Not only is the poor design true, it was very intentional. This is why we need the LLVM project. KDevelop and such shouldn't have to write their own compiler front ends to get feature parity with Visual Studio; but right now they do.
Re:What's the clear advantage of LLVM? (Score:5, Informative)
I don't see anybody addressing this question adequately. Here goes for a start.
1) g++ has simply awful error messages for template code. clang++ has MUCH more helpful error messages. Of not quite so much importance, all clang/clang++ error messages are significantly better than those of gcc/g++. Looks like clang++ has spurred g++ to improve error messages in 4.8 though. They NEEDED to be improved.
2) clang++ 3.1 has significantly better C++11 support than g++ 4.7:
Rvalue refs for *this
Alignment support
Strong compare-exchange
Bidirectional fences
Atomics in signal handlers
Also borrows from C99 one very significant enhancement: C99 designated initializers
References:
clang: Expressive Diagnostics [llvm.org]
C++0x/C++11 Support in GCC [gnu.org]
C++98 and C++11 Support in Clang [llvm.org]
Re:Grin (Score:0, Informative)
The GPL doesn't force you to give the software away. You can sell it. Indeed, RMS himself used to **sell** tapes of GPL software to fund the FSF. RedHat make *billions* on per-seat licensing of GPL software. Nor does GPL software force you, as an author, to GPL all the software. As the author you are completely free to draw the line as you wish between which bits of your software are GPL and which proprietary. You just grant yourself an exception.
Hu? Let say you release a part of your software under GPL and "draw a line" for the rest, I'm entitled to ask you to release the whole thing under GPL, unless you're able to prove that the part you put on the other side of the line is not a derivative work of GPL'd part. In other word, you cannot release half of a software as GPL.
I'm not GP, but you seem to be also a bit short in your understanding of the GPL.
Re:Grin (Score:4, Informative)
Here are some very interesting, compelling reasons to switch to Clang:
http://channel9.msdn.com/Events/GoingNative/GoingNative-2012/Clang-Defending-C-from-Murphy-s-Million-Monkeys [msdn.com]