Slashdot Mirror


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

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!"

18 of 360 comments (clear)

  1. Not GPL, and suitable for JIT by tepples · · Score: 4, Informative

    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.

    1. Re:Not GPL, and suitable for JIT by TheRaven64 · · Score: 4, 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.

      --
      I am TheRaven on Soylent News
  2. Re:What's the clear advantage of LLVM? by Poeli · · 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.

  3. Re:What's the clear advantage of LLVM? by alexgieg · · Score: 4, 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.

    --
    Conservatism: (n.) love of the existing evils. Liberalism: (n.) desire to substitute new evils for the existing ones.
  4. Re:What's the clear advantage of LLVM? by sribe · · Score: 5, Interesting

    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?

    Much better modularization, so that the tokenizer used by the compiler is easily available to other tools, so that your editor does not have to (try to) re-implement all the intricacies of C++ syntax, so that parse tree & symbolic info is available to your IDE, so that it does not have to try to re-implement parsing of all the intricacies of C++ templates & namespaces in order to give you cross-referencing or even re-factoring functions (not to mention support for a debugger that can actually figure out types in a complex inheritance hierarchy).

  5. Re:Grin by Anonymous Coward · · Score: 5, Informative

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

  6. Re:Grin by ByOhTek · · 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).

    --
    Self proclaimed typo king, and inventor of the bear destroying coffee table (patent not pending).
  7. Re:Why switch at all? by Cinder6 · · Score: 5, Informative

    Could check this article: http://clang.llvm.org/comparison.html

    Apple made the switch a while back in Xcode. The end result was much better debugging and refactoring capabilities.

    --
    If you can't convince them, convict them.
  8. Having a strong competitor to GCC by stox · · Score: 4, Insightful

    will drive GCC to a far greater degree than without a competitor. This is good for all involved.

    --
    "To those who are overly cautious, everything is impossible. "
    1. Re:Having a strong competitor to GCC by serviscope_minor · · Score: 4, Insightful

      Well, better for some people. I suspect that the first fallout of any industry shift to LLVM will be that the public compiler will be significantly lacking in optimizations while the expensive, proprietary versions will have all the good optimizations.

      Not just that.

      I remember the bad old days where every venduh and his dog had their own "extra proprietary super awseome dongle controlled extra awesome super cool" compiler.

      Vendors of hardware *LOVE* proprietary compilers. And by love, I mean love to break in mysterious and subtle ways.

      Once gcc took off in the embedded world, life got a lot better since many of the cheaper vendors would just use as close to stock gcc as possible (though usually with a little bit of extra internal compiler errors added), rather than some extra super proprietary extra messed up version.

      This isn't a business issue. There is no sane business case for taking a commercial compiler front end and a commercial compiler back end, filling it with extra bugs and shipping it. But hardware vendors love to believe that they have an awesome proprietary advantage in software for some reason. Even though they sell hardware. They don't, of course. I'd just say "whatever" except that turns rapidly into invective if one is forced to use their "tools".

      Once GCC came along, they believed that they no longer had such an advantage (presumably) so they stopped introducing their extra proprietary bugs into compilers, and limited themselves to a few extra miscellaneous bugs. But it was still mostly gcc and still mostly worked.

      If LLVM comes to dominate, the hardware vendors will jump right back on that attitude and make the life of the humble developer hell again.

      This isn't a religious, or philosophical issue. It's a "hardware vendors are mental" issue.

      --
      SJW n. One who posts facts.
    2. Re:Having a strong competitor to GCC by Microlith · · Score: 4, Insightful

      XCode using LLVM+CLang as the default compiler for all projects?

      That's hardly an industry shift and you know it.

      And secondly, what "expensive, proprietary version"? This does not exist - you have invented it, for the purpose of anti-BSD rhetoric.

      So we're going to ignore all of the proprietary, seat-licensed compilers out there?

      This is a paranoid possibility in your Stallman-dizzied head, not an actual fork.

      Quick! Into the name-calling and ad-hominem!

      Apple, for instance, roll all the LLVM+CLang fixes back into mainline.

      Do they? Unless you're on their compiler team you can't possibly know this.

      I believe the phrase "you mad" applies very, very well to your spittle-flecked rant here.

  9. "economic reasons" by tlambert · · Score: 4, Interesting

    A lot of graphics software infringes on existing patents, but that isn't a reason you can state without risking treble damages in a lawsuit, so most of the graphics driver writers tend to just look the other way and hum as they dance past that particular graveyard. Practically, it's impossible to write genuinely competitive graphics code without infringing some East Texas idiot's patent.

    There are also cases where code has specific strategic value to a company, and they want to amortize the cost of development over some period of time before they let their competitors use the code. For example, the Soft Updates code that Kirk McKusick, Julian Elisher, and I worked on for FreeBSD was licensed under a free-for-non-commercial-use license for a period of two years before we opened it up for general use. This was to allow us to recoup the investment on developing the code by allowing us to run our hardware without a UPS, while everyone else in the market had to have a UPS to deal with power failure and recovery. If you don't have it, you have to treat a power failure as a kernel panic and do a full fsck in order to return your disk to a known good state, since you can't otherwise guarantee that it wasn't a crash followed by a triple fault, which might have written bad data to some portion of the disk. So all the competing border router/SOHO server devices had to have batteries, which increased their cost relative to our product. It's one of the reasons IBM bought our company.

    Yeah, it'd be great if some idiot were to spend 10 years of their free time neglecting their families so that all this stuff could be free, but no one really wants to be that idiot: people work on free software for love, and they work on the hard problems and productization in exchange for money, since no one is going to do scut work for free unless they're a masochist (if you happen to know one, though, I have a project or two they could tackle if they really wanted to suffer).

  10. Re:Grin by Creepy · · Score: 5, Interesting

    It isn't necessarily an issue with the GPL (aside from 3 being invasive, which I personally have an issue with and so do the lawyers I work with) - I have a problem with Stallman's (aka RMS) model, which says charge for hardware and give the software with source away for free.

    I worked for a CAD software company (we were bought by a huge multinational conglomerate, so I technically still work for them, but I moved around and rarely touch CAD these days). In our former incarnation, we sold exactly no hardware and were bundled with exactly zero hardware, but ran on pretty much every platform imaginable (9 at one point, but much fewer now, since our customers are mostly moving to Linux or Windows). Giving away our software (not to mention the source code) would be a really bad business model, but to appease those in RMS's dream world, we'd need to find hardware partners and give it away for free with the hardware and be paid by the hardware vendor - but since we have to give away source, we'd more than likely use an in-house developed proprietary language to make porting as difficult as possible. This, in fact, is a BAD and not very open business model - if we'd been bought by our current owner, we'd almost certainly be proprietary software for their hardware and not run on platforms like Linux or even Windows. This happens in the console world all the time - when Microsoft bought Bungie, they basically shafted what Bungie was known for - mac games (and took a year to release Halo on Windows/Mac to keep it XBox exclusive as long as possible to the ire of Steve Jobs - later releases became XBox exclusive). If you think that is a good thing, great for you - I don't. Incidentally, the part of the company I work for has an open data model as well - that makes it easy for customers to switch, but we are doing our jobs well because few actually do.

    I've been at odds with RMS over this for years...

  11. Re:Grin by Anonymous Coward · · Score: 4, Insightful

    With BSD software, not only are you giving away the source code, but you are giving it away with even fewer restrictions than with GPL.

    What's that you say? You want to take the software that other people have released and use it in your closed source product? Well then of course you like BSD software better. But you can obviously see why many people who write the open software prefer a GPL style.

  12. Re:Grin by DeathFromSomewhere · · 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.

    --
    -1 overrated isn't the same thing as "I disagree".
  13. Re:What's the clear advantage of LLVM? by fnj · · 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
    C++0x/C++11 Support in GCC
    C++98 and C++11 Support in Clang

  14. Can modify GPL'd code, make money and *not* share by perpenso · · Score: 4, Insightful

    GPL is for people and companies that think "I wrote this software [together with X, Y and Z] and if somebody else makes it better they must share it with all the world, as I did."

    That is quite misinformed. Organizations can modify and use GPL'd code internally, make a lot of money off of it, and not share with anyone. I believe Google does so.

    BSD is for people and companies that think "I wrote this software [together with X, Y and Z] and I accept the loss that somebody else makes it better and keep it for themselves because I want to have the option of getting somebody's else software, make it better and keep it for me without sharing it back."

    Beyond misinformed, merely a spouting of FSF spin.

    In truth the BSD folks want the widest possible distribution of their software because they believe that will ultimately provide the computing world the greatest benefit. BSD Unix arguably did provide quite a benefit to both hobbyists and corporations.

    Perhaps more importantly is that BSD Unix was a product of the University of California, a taxpayer funded entity, and they felt that all taxpayers should have equal access to their work. That the politics of picking good users and bad, approved uses of the software and unapproved, etc was wrong.

  15. Re:Your anti-GPL FUD is inaccurate and unconvincin by Bengie · · Score: 4, Insightful

    It seems to me that the ability to "lock up" formerly free software has enabled the worst actors in the global market for computer software to accumulate wealth and power which they have then used to distort the market to the detriment of free software authors. The GPL is a response to this perception.

    The software is always free. What they do is not make their changes free, but the original is still free as ever.

    An idea cannot be "stolen" or "taken away". The original will always remain.

    Personally, I think most people's ability to think breaks down once "infinite" is involved. I have no qualms with GPL, but your argument is full of holes. You are as bad as the RIAA claiming others steal their work and every stolen copy is a lost sale. Please revise your argument, it makes the GPL look like a bunch of zealots use it.