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

31 of 360 comments (clear)

  1. Grin by Whiteox · · Score: 3, Funny

    I'm just so HAPPY!

    --
    Don't be apathetic. Procrastinate!
    1. Re:Grin by Anonymous Coward · · Score: 5, Informative

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

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

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

    5. 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".
    6. Re:Grin by Zenin · · Score: 3, 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.

      But you're not forced to give all of it away, as you effectively are with the GPL.

      If you've created something that you'd like to give back to the community, you can. -And it's very often in your own best interests to do so. If however, you've created something that, at least for now, you'd prefer not to give away, well you're free to do that instead.

      The BSD model has proven that you don't need to twist peoples arms to get them to give back generously to the community. It's proven that people can have the freedom to choose whatever business model they feel is best for them, and the community still benefits greatly. Often more so then a GPL model.

      GPL... Among many freedoms it takes away, it destroys the freedom to select a business model of your choice. And worse, the few business models that the GPL does allow for are intrinsically very, very bad on the whole. You're either forcing odd hardware/software partnerships like the poster above, or you're relying upon creating sloppy software and weak documentation in order to ensure a market for your "support services". The later, IMHO, is a primary cause behind the quality issues that have forever plagued GPL software quality, design, and documentation.

      --
      My /. uid is better then your /. uid
    7. Re:Grin by statusbar · · Score: 3, 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

      --
      ipv6 is my vpn
    8. Re:Grin by Rich0 · · Score: 3, Insightful

      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.

      Only if you wrote part of it. If I write a program and release half of it under the GPL, the only person who can sue me over it is me.

      The GPL is only an issue if you want to steal other people's code. It doesn't force you to do anything with code you write, unless you mix it with code you didn't write and don't have a license to use (other than the GPL).

    9. Re:Grin by fast+turtle · · Score: 3, Interesting

      unlike GCC, Clang/LLVM was designed to ensure the optimizations are the same each and every build. This means you can compile from source and check the md5 sum of your binary against the master md5 and know if the source has been modified before compilation. Critical for signed binaries.

      Another benefit is the support for older hardware that's been dropped by the GCC team along with ease of debugging. I've had compiler optimizations introduce unexpected bugs/failure mode in the Linux kernel itself that disappeared when the No Optimization flag was set. Simply put, if the kernel isn't stable, I don't give a damn how stable the rest of your system is, it's not stable because you can't trust the kernel and that's why Clang/LLVM is all about.

      --
      Mod me up/Mod me down: I wont frown as I've no crown
    10. Re:Grin by ckaminski · · Score: 3, Insightful

      Everyone seems to forget that the GPL wasn't created for DEVELOPER freedom, but for end-user freedom.

      Dummies. :-P

    11. Re:Grin by unixisc · · Score: 3, Insightful

      But you're not forced to give all of it away, as you effectively are with the GPL.

      Utterly false.

      You can license just part of your own code as GPL and release as much or as little as you want.

      You even still retain complete control of your code that you have previously released as GPL, so you can then take it and change it or use it in your closed software, or license it out for a price to someone, or release it as BSD.

      Yeah, but this right is denied downstream, ironically under the very copyleft clauses that claim to preserve the 'software freedom'.

      The BSD model has proven that you don't need to twist peoples arms

      GPL is not twisting anybody's arm. I challenge you to find a single example of a GPL project which has engaged in predatory patent trolling, deliberate compatibility breakage to harm competition, or format or protocol obfuscation to lock in customers. Things which some closed software companies engage in regularly is completely against the nature of open source development, but also open source makes it pretty hard for any of those techniques to be effective.

      Not saying it would never happen, but there is nothing about the GPL license that twists anybody's arm.

      Oh, you meant "you twisted my arm" as-in, "I want to use your code that you own the rights to, but under the terms I set. Waaahhh.". In that case, fuck you, that's copyright infringement and have fun destroying people's livelihood, hypocrite.

      It's not an issue of mere taking the code and changing the terms - let's say I took something that the GP had written and modified it, and then distribute the modified version, that's where the differences start. With GPL, I'm forced to release the source code of my modifications. With BSD, I don't have to - only the original BSD source code has to be given, but I still have the option of keeping the source code of my modifications to myself, even while distributing.

      GPL... Among many freedoms it takes away

      Stopped reading there. You're either a massive troll or a clueless friggin nincompoop.

      Read the 4 freedoms on the home page of the FSF. GPL violates every one of them.

  2. 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 pmontra · · Score: 3, Insightful

      These are not exactly the terms of GPL and BSD but:

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

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

      I think we can argue forever on the ethic merits of the two approaches (I feel in the GPL camp). Anyway both GPL and BSD make economic sense and we won't be talking about them if they didn't, one or both would be dead long time ago. If a company wants to include some big secret in its code, it must go BSD and occasionally regrets it can't use some GPL code and rant about it. Sometimes the GPL people rant about not being able to include BSD code in their projects.

    2. 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
    3. Re:Not GPL, and suitable for JIT by TheMMaster · · Score: 3, Insightful

      Actually it is much simpler than that;

      GPL is designed to protect users' interests
      BSD is designed to protect developers' interests

      --
      Fighting for peace is like fucking for virginity
  3. 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.

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

  6. Don't knock it until you've tried it by Viol8 · · Score: 3, Interesting

    FreeBSD might not be anywhere near as popular as linux but its a damn good system, and whats more there arn't endless ever-so-slightly incompatable distributions of it. Ok, its never going to threaten Linux but its good to have a proper alternative free Unix system available that is actually interested in its end users and isn't just a pet project of the devs (unlike certain other BSDs I could mention).

  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:WOW by gnasher719 · · Score: 3, 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.

  11. Free software could leak cleartext or keys by tepples · · Score: 3, Insightful

    You even mention why: what would these software packages be without their WAD files, tax definition files and encryption keys.

    A video game licensed as free software could be modified to leak the decrypted WAD files. Furthermore, console makers forbid use of a copylefted engine. This means a copylefted game can't run on consoles, which means it can't use the large monitor and multiple gamepads that the player already owns for the console but wouldn't consider buying for a PC. (There are some major genres of video games that for economic reasons cannot be released as PC exclusives; I can explain in more detail if you wish.)

    A DRM crippled video player licensed as free software could be modified to leak the decryption keys, something that Disney, Fox, Paramount, Sony, Universal, and Warner Bros. forbid.

    A tax program licensed as free software could be modified to leak the decrypted tax definition files.

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

  13. Your anti-GPL FUD is inaccurate and unconvincing. by Medievalist · · Score: 3, 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.

    And frankly, while I support your freedom to release your code under any license you wish (a freedom many BSD people don't seem to like) I find these "GPL tekks away mah freederms" sound bites laughable. You said "it destroys the freedom to select a business model of your choice". What utter tripe.

    The copyright laws that empower the GPL (if you choose to use GPL'ed code, instead of doing your own work with the sweat of your own brow) restrict your choices of business model, just like laws against theft, murder and rape do. Comparing restriction of choices to removal of freedom is disingenuous rhetorical grandstanding; do you protest the Earth's gravity restricting your freedom to fly? Do you protest the sun's light restricting your freedom to walk around naked without getting sunburned? Do you protest society restricting your freedom to practice cannibalism and slavery? Your argument is ridiculous; it sounds like you want to steal my work against my will and profit by it, and you're crying because copyright laws will allow me to prosecute you if you try to cheat me.

    Use whatever license you choose, but stop pretending anyone ever had a "freedom" to use other people's code in ways the authors have specifically forbidden, and that this fake "freedom" has been taken away. Nothing has been lost except the ability to be an ugly, hypocritical parasite on the hard work of other people - people who are more than willing to share their efforts with the world, as long as the terms are share-and-share-alike, as in the GPL and similar licenses.

  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.