Slashdot Mirror


FreeBSD 10 To Use Clang Compiler, Deprecate GCC

An anonymous reader writes "Shared in last quarter's FreeBSD status report are developer plans to have LLVM/Clang become the default compiler and to deprecate GCC. Clang can now build most packages and suit well for their BSD needs. They also plan to have a full BSD-licensed C++11 stack in FreeBSD 10." Says the article, too: "Some vendors have also been playing around with the idea of using Clang to build the Linux kernel (it's possible to do with certain kernel configurations, patches, and other headaches)."

16 of 711 comments (clear)

  1. What's wrong with GCC? by jomcty · · Score: 5, Interesting

    What's wrong with GCC?

    1. Re:What's wrong with GCC? by jps25 · · Score: 5, Informative

      The GPL.

    2. Re:What's wrong with GCC? by bonch · · Score: 5, Informative

      Clang and FreeBSD aren't proprietary software. They're BSD-licensed open source. That code doesn't magically disappear when a company uses it.

    3. Re:What's wrong with GCC? by BasilBrush · · Score: 5, Informative

      Avoiding te GPL is the main reason. But Clang also has many technical superiorities to GCC too. Wikipedia gives a quick outline of them.
      http://en.wikipedia.org/wiki/Clang

    4. Re:What's wrong with GCC? by Alex+Belits · · Score: 5, Interesting

      And WHY would a company want to avoid GPL compiler, unless it intends to distribute a sabotaged version of the compiler?

      --
      Contrary to the popular belief, there indeed is no God.
    5. Re:What's wrong with GCC? by ommerson · · Score: 5, Informative

      One of the key design objectives of Clang is that it is highly modular, and implemented in such a way that various compilation stages are self-contained, and have clean APIs and data structures. This allows development tools such as IDEs to link directly against the stages of the compilation pipeline then need to implement syntax highlighting, code completion, refactoring tools and so on.

      Apple's XCode does precisely this, and licensing and lack of modularity in the GCC source tree would have been major factors in their choice to support Clang and LLVM development.

      The traditional way of implementing these functions in IDEs has been to effectively re-implement the front-end of the compiler (often not completely). This is a big deal when developing in C++ against the STL/Boost/TR1 when you find that code completion can't grok template properly. This is something that XCode and Visual Studio (which takes a similar approach) are both capable of doing.

    6. Re:What's wrong with GCC? by zixxt · · Score: 5, Informative

      1) It compiles slower than clang at -O0
      2) It produces slower code than clang at -O3 and -Os
      3) It's error and warning messages are not as good
      4) It's not as modular as clang, which can be used in parts, to produce useful tools like CSA
      5) The GPL.

      Got facts to back this up? Every benchmark I have seen as showed GCC producing faster code than Clang on 90% of the time, Phoronix benchmarks has in the last week showed this to be true.

      --
      ---- GENERATION 26: The first time you see this, copy it into your sig on any forum and add 1 to the generation.
    7. Re:What's wrong with GCC? by hairyfeet · · Score: 5, Insightful

      I normally don't respond to ACs but this is one thing I've noticed and found interesting....anybody notice how the Anti-BSD GPLers sound a HELL of a lot like the RIAA? Both act as if copying is stealing, both come up with these giant FUD scenarios of doom which never seem to happen, and both act as if THEIR way is the only 'right" choice and frankly you are an idiot or "one of THEM!" if your views don't stay in lock step with their own.

      I just find it fascinating that those that constantly scream they are for "freedom" sound a hell of a lot like the most restrictive bunch out there.

      --
      ACs don't waste your time replying, your posts are never seen by me.
  2. GPLv3 by bonch · · Score: 5, Insightful

    Having all this great open source compiler technology competing with each other is great, but one does wonder if the alienation caused by GPLv3 was worth it, as it is the primary reason both Apple and FreeBSD embraced Clang (in fact, Apple started the Clang project). As a result, GCC wasn't updated past GPLv2 on either platform. Apple couldn't integrate GCC with their IDE like they wanted, nor could FreeBSD's commercial clients work with it. Flexibility and pragmatism usually wins out over rigidness and ideology.

  3. Re:in other words by bonch · · Score: 5, Interesting

    One of the FreeBSD developers gave a talk about this. FreeBSD has commercial users, and the new GCC just wouldn't have been an option for them. The older license-compatible version still in FreeBSD wasn't receiving updates, and it was beginning to affect developers too greatly.

    Whether this compiler switch is a good thing or not depends on how much you hate the idea of commercial vendors using open source. GCC's strictness is admiral from an ideological perspective, but certainly not from a practical one. It should be noted that even Linus Torvalds adheres to a more pragmatic worldview:

    There are "extremists" in the free software world, but that's one major reason why I don't call what I do "free software" any more. I don't want to be associated with the people for whom it's about exclusion and hatred.

    It's pretty damning when Linus himself no longer refers to Linux as free software because he doesn't like the extremism of the free software movement. And why should he? He's an engineer, not a religious fundamentalist.

  4. Re:in other words by cupantae · · Score: 5, Insightful

    It's not quite as simple as that. The development of Clang is being funded by Apple. They need a BSD license so that they have the freedom to make further modifications down the line (without leaving them open). Yes, I'm a GPL advocate. No, I don't agree with Apple's ideology. But it's the case anyway.

    In any case, it doesn't do us any harm to have an underdog in the world of open source C compilers. If you only have one option, then people start treating even the programme's eccentricities as standards. The need for compatibility encourages people to document. Not to mention that the different attitude taken in Clang from the offset means that it may be more suitable for certain applications. This page makes for some interesting reading.

    --
    --
  5. Not a bad idea by gman003 · · Score: 5, Insightful

    I've found that code that will compile properly under a variety of compilers tends to be of better quality.

    One of my current projects started out on an old 2.x branch of GCC. When I finally got around to updating to a current GCC, I had to fix quite a few bugs before it would actually work - the different compiler was catching problems I hadn't noticed before.

    Same when I tried compiling it under Visual Studio, or Clang - the more compilers I made it work under, the less bugs there were in the code.

    Now, if a given program actually uses some special feature of GCC, that's fine - if only one compiler will do what you need, that's fine. Or if it's too much work to maintain a "port" - I stopped maintaining the VS project files a while ago, since I no longer used it. But if you have a chance to at least test it against a different compiler, go ahead and give it a shot.

  6. Re:Dropping the GPL ~= worse. by mister_playboy · · Score: 5, Informative

    There's a reason even the shining monument of GPL (Linux) uses GPLv2...

    Even if Linus did want to move the kernel to GPLv3 (he doesn't), he would have to get every kernel contributor to agree to the license change, AFAIK.

    --
    Do what thou wilt shall be the whole of the Law ::: Love is the law, love under will
  7. Re:Dropping the GPL ~= worse. by asdf7890 · · Score: 5, Insightful

    Complaining about the GPL

    He wasn't complaining about the GPL, he was stating (correctly) that it is one of the key reasons some groups choose not to use GCC, particularly GPL version 3 (note that FreeBSD has not used and of the recent GCC release specifically for that reason - they were fine using GPLv2).

    It is a case of choosing the right tool for the job. Until recently their choice was to redefine the job (change the parts of their projects and licensing policy that GPLv3 conflicted with), keep the old tool (using older, GPLv2 licensed, releases of GCC only), or use something less stable/proven/compatible. They chose the middle option. Now option three is replaced by "use something else that is now stable/proven/compatible enough to be an alternative" they have taken that choice. Again this isn't complaining about GPLv3, it is simply refusing to use it because it is incompatible with some of their chosen goals.

    I'm told there are technical reasons why Clang and the related tool chain are preferable to GCC in some circumstances too, though I'm out of the loop on that one so I don't know what they are or if they are significant to FreeBSD.

    While his answer was rather terse and it would have helped to be less so (it made him appear to some, to you at least, like an anti-GPL troll), what you appear to have done in your response is set up a strawman to attack. This is the sort of thing that anti-GPL people (both within the open-source arena and external to it) will jump on as "proof" that GPL advocates are rabid loonies, so by defending the GPL in such a manner you may be harming the cause rather then helping it. You might want to be more careful not to come across that way (it may not have been you intention on this occasion, but it does seem that way by my reading).

  8. Re:Dropping the GPL ~= worse. by Stormwatch · · Score: 5, Insightful

    Many people wants _real_ freedom for their software

    No, they don't. If they did, they'd use GNU GPL v3.

    But I think you mean the opposite of what you said: people want to be free to do whatever they want with the software, including taking away the software's freedom.

    That's the thing. Free software is not about your freedom, it's about the software's freedom. It is not for the benefit of anyone in particular, it is for the benefit of the whole humanity. When you think about where rms came from, and when you read his writings, you realize that his ideal is not an indifferent "here's some code, use as you wish". It is an ideologically grounded "here's some code, it's for everyone to use, and if you build upon it, the result is also for everyone to use".

  9. Re:Dropping the GPL ~= worse. by jbolden · · Score: 5, Informative

    We don't have to guess which model works best, at this point we have historical data. Your model failed with respect to X. MIT created and maintained an X that they released via. the MIT license. All the UNIX vendors then took this MIT code and intermixed it with their custom code creating value add X's that were specific to their platform, and closed source. The effect was that the X that existed in the public domain was worthless for end users, and the X's that were worthwhile were closed. X itself couldn't progress because it fragmented so all the interesting stuff existed in other layers. Years later when there was a desire for a workable open X, the XFree86 project had to start, essentially from scratch and this took years. We still haven't gotten all the features that existed in those proprietary Xs 2 decades ago.

    That is the classic example of why BSD style licensing doesn't work. The primary maintainer is not unchanging.

    Conversely the GPL has a long history of successful multi corporate contributions over time. The historical data simply refutes your theory of what should work.