Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
GNU is Not Unix Open Source Unix BSD News

FreeBSD 10 To Use Clang Compiler, Deprecate GCC 711

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)."
This discussion has been archived. No new comments can be posted.

FreeBSD 10 To Use Clang Compiler, Deprecate GCC

Comments Filter:
  • by jomcty ( 806483 ) on Sunday May 13, 2012 @12:14PM (#39986849)
    What's wrong with GCC?
    • by jps25 ( 1286898 ) on Sunday May 13, 2012 @12:16PM (#39986869)

      The GPL.

      • by DarkHelmet433 ( 467596 ) on Sunday May 13, 2012 @12:34PM (#39987031)

        Well.. GPLv3 specifically. FreeBSD is stuck on GCC-4.2, the last GPLv2 gcc compiler. It's getting quite dated now. It's a switch from gcc-4.2.2+ hacks/patches to clang instead of a GPLv3'd gcc-4.6 or later.

        "Stuck"? FreeBSD gets a foot in the door of companies where GPL (and GPLv3 in particular) is something they'd prefer not to deal with. Being able to use a modern GPL-free OS as a foundation of a product is a convenient option to have. And being GPLv3-free can be even more compelling.

        • by Alex Belits ( 437 ) * on Sunday May 13, 2012 @12:37PM (#39987059) Homepage

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

          • by rubycodez ( 864176 ) on Sunday May 13, 2012 @12:47PM (#39987159)
            maybe they want to distribute a USEFUL version of the compiler, for a particular purpose. Stallman et. al has long battled to keep usable API and plugin points to the front end of gcc only, and to prevent such in all parts of the toolchain, even to keeping the documentation for parts obfuscated. screw that, some people want real freedom....
          • by gnasher719 ( 869701 ) on Sunday May 13, 2012 @02:24PM (#39987917)

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

            Apple had no problem using a GPL v2 licensed compiler. It looks like they have a huge problem using a GPL v3 licensed compiler. I suppose it has something to do with the difference in the licenses.

            Now you might want to consider the effects on a software developer of integrating a compiler into your own product. Which happens for example if you use OpenGL, or OpenCL.

        • by Kjella ( 173770 ) on Sunday May 13, 2012 @12:59PM (#39987265) Homepage

          "Stuck"? FreeBSD gets a foot in the door of companies where GPL (and GPLv3 in particular) is something they'd prefer not to deal with. Being able to use a modern GPL-free OS as a foundation of a product is a convenient option to have. And being GPLv3-free can be even more compelling.

          Not to troll, but what companies are those? What's the closest thing to Red Hat that's selling FreeBSD support, what volume are we talking about? Or are they all providing their own support? Don't get me wrong, I know particularly a lot of web hosting companies run it - 6/39 [netcraft.com] of the top providers on Netcraft's list are FreeBSD, but I doubt they have a problem with the GPL. If BSD went away, they'd probably just join all the Linux hosting companies. There's of course Apple and then there's.... who?

      • by Pinky's Brain ( 1158667 ) on Sunday May 13, 2012 @12:43PM (#39987117)

        The GPL has never really been the issue, LLVM was offered for GPL-Next ... but the GCC maintainers have always insisted upon a monolithic compiler without standardized intermediary representations to prevent other compiler builders just using GCC as a front end and thus refused, but that's on the maintainers and not the GPL.

    • by vlm ( 69642 ) on Sunday May 13, 2012 @12:22PM (#39986931)

      Aside from the more or less irrelevant licensing issue, clang is all about the source analysis tools, refactoring, rewriting support. Uses less memory and time. Both caused by lack of optimization.

    • by BasilBrush ( 643681 ) on Sunday May 13, 2012 @12:24PM (#39986947)

      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 [wikipedia.org]

      • by tepples ( 727027 ) <tepplesNO@SPAMgmail.com> on Sunday May 13, 2012 @12:55PM (#39987231) Homepage Journal

        But Clang also has many technical superiorities to GCC too. Wikipedia gives a quick outline of them.
        http://en.wikipedia.org/wiki/Clang [wikipedia.org]

        And at the top right of that page is this picture [wikipedia.org]. Which Pokemon is that?

    • by rev0lt ( 1950662 ) on Sunday May 13, 2012 @12:27PM (#39986965)
      No only licensing issues, but also performance. While CLANG may not have all the bells and whistles of GCC, it does a good job compiling C code - and given that the base system is mostly C, even a small improvement in compile time (and memory usage) can make a big difference, specially for those who - like me - prefer to build and upgrade from source.
      Another motive to seek alternatives (but not directly related to FreeBSD) is the lack of support of some architectures. Some "obsolete" architectures were removed post GCC 2.95, but some BSDs still support them today. Having a easy to port, actively developed, BSD licensed compiler is way better than to rely on some archaic GCC version.
    • by perpenso ( 1613749 ) on Sunday May 13, 2012 @12:30PM (#39986997)

      What's wrong with GCC?

      Some people argue that LLVM/Clang offers better code generation, compile time warnings, and code analysis. Some compiler developers think the gcc code has become too bloated and complicated. Even gcc devs have described the gcc code as "cumbersome".

      There are various efforts to get Linux building under LLVM/Clang. Especially for embedded environments.

      • GCC always shows the offending line, clang does not.

        For example, if you have a printf()-like function whose format string has a default value, every use will emit:
        warning: format string is not a string literal (potentially insecure) [-Wformat-security]
        without a mention of the line in question. The default value here is also a literal, making the whole warning bogus in the first place.

    • by beelsebob ( 529313 ) on Sunday May 13, 2012 @12:41PM (#39987097)

      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.

      • by zixxt ( 1547061 ) on Sunday May 13, 2012 @02:36PM (#39987995)

        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.

  • in other words (Score:5, Insightful)

    by phantomfive ( 622387 ) on Sunday May 13, 2012 @12:17PM (#39986875) Journal

    and suit well for their BSD needs

    In other words, it has the license they want. GCC was a thorn in the side of the collective BSD conscience, they didn't like it.

    • Re:in other words (Score:5, Interesting)

      by bonch ( 38532 ) * on Sunday May 13, 2012 @12:36PM (#39987049)

      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 [linux-mag.com]:

      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.

    • Re:in other words (Score:5, Insightful)

      by cupantae ( 1304123 ) <maroneill@gm a i l.com> on Sunday May 13, 2012 @12:42PM (#39987103)

      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 [llvm.org] makes for some interesting reading.

  • GPLv3 (Score:5, Insightful)

    by bonch ( 38532 ) * on Sunday May 13, 2012 @12:20PM (#39986915)

    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.

  • Not a bad idea (Score:5, Insightful)

    by gman003 ( 1693318 ) on Sunday May 13, 2012 @12:53PM (#39987207)

    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.

  • by ruinevil ( 852677 ) on Sunday May 13, 2012 @01:57PM (#39987719)
    I believe it was really the Tivozation rule of GPLv3 that forced FreeBSD to abandon GCC in their base. FreeBSD wanted to ensure that a specific version of GCC would be in their highly integrated base operating system. The FreeBSD base has no real comparable analogue in the Linux world, but its a system that is tested and designed to work together from the pseudocode to the final compiled product. GPLv3, with its Tivozation clause, however, made this tying together essentially illegal.

    Also the BSDs have long since desired to remove GCC from their base system simply because it has a different license than the rest of the base. They attempted using PCC, but the code it produced was not optimized to a level comparable with GCC. clang/LLVM however, is both BSD licensed and produces well optimized code. Its also newer and cleaner code; sometimes rebuilding everything from scratch helps (though usually not).
  • GCC license (Score:4, Interesting)

    by maestroX ( 1061960 ) on Sunday May 13, 2012 @03:36PM (#39988603)

    GCC doesn't need GPL, a freeware license would suffice.

    Over the years I've read and analyzed the sources and consistently found the source to be as readable as the binary code, regardless of platform.

    Compiler developer forums seem to confirm my findings with frequent comments and insults on GCC like:

    • "you retard GCC haxxors do macro-ni and spaghetti all day! "
    • "how do I build XXX frontend for GCC?" [first and last post of many aspirant compiler developers]
    • [primordial grunt] "<junk>" [poster last seen on VB forum]

    Nonetheless, I praise the omnipotence of GCC, as long as I'm not the first guy on a new platform.

  • by Jeff- ( 95113 ) on Sunday May 13, 2012 @04:33PM (#39989027) Homepage

    I'm a 10 year+ FreeBSD contributor. You're all missing the point. Linux and BSD target different markets and are optimized in all ways, organization, release process, license, code, to fit these different needs. One isn't better or worse. Obviously Linux is larger in all ways than BSD but larger doesn't mean better or we'd all just be using windows. This isn't a question of llvm being better than gcc, bsd being better than linux, or bsd license being better than gpl. They are just different and do different things. Use what's appropriate for your needs and leave it at that.

    I can say as a long time contributor to opensource software I am disgusted at reading the comments of blowhard 'enthusiasts' who denigrate the hard work and contributions of hundreds of people when they get in these pissing matches. I am friend with Linux kernel contributors and I can guarantee we don't flame each other in this manner.

  • History (Score:5, Interesting)

    by TopSpin ( 753 ) on Sunday May 13, 2012 @05:36PM (#39989509) Journal

    At the moment I write this there are 297 comments mostly debating the merits of LLVM/Clang vs. GCC. There is not one mention of EGCS.

    Fifteen years ago GCC was forked [google.com]. A group of people we're frustrated with GCC and its leadership because they had contributions to make and talent to offer that was not welcome. They called their fork EGCS.

    Why are we doing this? It's become increasingly clear in the course of hacking events that the FSF's needs for gcc2 are at odds with the objectives of many in the community who have done lots of hacking and improvment [sic] over the years.

    The GCC you use today is EGCS. A few years later EGCS was adopted as GCC 2.95 after the merits of EGCS became undeniable.

    Looks like we've come full circle. The cool kids are off in the weeds making cool stuff. Better stuff, and the `Powers That Be' are not interested. The `needs' of the FSF today are no longer in sync with the `needs' of the developers of today.

    The bottom line is that GCC as it is with it's leadership, code base and license agenda doesn't cut it for those who have the talent, motivation and capital to create a tool chain that does cut it. You don't get to impede that, however righteous you think you are.

    Freedom. Deal with it.

You can be replaced by this computer.

Working...