Forgot your password?
typodupeerror
Unix BSD

FreeBSD Throws the Clang/LLVM Switch: Future Releases Use LLVM 360

Posted by Unknown Lamer
from the rms-weeps-quietly dept.
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!"
This discussion has been archived. No new comments can be posted.

FreeBSD Throws the Clang/LLVM Switch: Future Releases Use LLVM

Comments Filter:
  • by Anonymous Coward on Wednesday November 07, 2012 @11:43AM (#41908101)

    Never really understood the motivation for switching away from GCC. Please enlighten me.

    being bsd people, they don't like the gpl.

  • by tepples (727027) <tepples&gmail,com> on Wednesday November 07, 2012 @11:43AM (#41908109) Homepage Journal
    For one thing, LLVM isn't copylefted, making it available for use as part of non-free software. (There are some major categories of software that for economic reasons cannot be released as free software; I can explain in more detail if you wish.) For another, it's designed to allow just-in-time compilation of bytecode, such as what might be seen in a Flash, Java, .NET, or JavaScript VM, in addition to standard ahead-of-time compilation of source code into native code.
  • by Poeli (573204) on Wednesday November 07, 2012 @11:45AM (#41908143)

    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.

  • by alexgieg (948359) <alexgieg@gmail.com> on Wednesday November 07, 2012 @11:48AM (#41908179) Homepage

    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)

    by Anonymous Coward on Wednesday November 07, 2012 @11:59AM (#41908315)

    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)

    by Anonymous Coward on Wednesday November 07, 2012 @12:00PM (#41908335)

    This explains it well: http://unix.stackexchange.com/a/49970/7345

  • Re:Grin (Score:5, Informative)

    by ByOhTek (1181381) on Wednesday November 07, 2012 @12:06PM (#41908421) Journal

    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).

  • by Cinder6 (894572) on Wednesday November 07, 2012 @12:14PM (#41908527)

    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.

  • by TheRaven64 (641858) on Wednesday November 07, 2012 @12:43PM (#41908873) Journal

    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)

    by gnasher719 (869701) on Wednesday November 07, 2012 @12:54PM (#41908997)

    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.

  • by KiloByte (825081) on Wednesday November 07, 2012 @12:59PM (#41909051)

    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)

    by DeathFromSomewhere (940915) on Wednesday November 07, 2012 @01:08PM (#41909127)

    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.

  • by fnj (64210) on Wednesday November 07, 2012 @01:13PM (#41909175)

    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)

    by Anonymous Coward on Wednesday November 07, 2012 @02:16PM (#41909911)

    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)

    by statusbar (314703) <jeffk@statusbar.com> on Wednesday November 07, 2012 @02:52PM (#41910357) Homepage Journal

    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]

Swap read error. You lose your mind.

Working...