Roman Divacky on behalf of the ClangBSD team writes “ClangBSD is a branch of FreeBSD that aims at integrating clang into FreeBSD, replacing GCC as a system compiler. Recently, we’ve achieved the state when clang can compile all of FreeBSD world
on i386/amd64 platforms (including all the C++ apps we have and itself)
and a bootable kernel. Thus we feel that the time has come to ask the FreeBSD
community for wider testing on i386/amd64 (you sure can help with other
platforms too :)).”
While I don’t see why this is such good news for FreeBSD itself, it is certainly good for the collective free software developer world. The presence of an additional fully-featured free compiler creates competition in the area, which will increase the quality of both compilers and benefit all developers and users.
I think the interesting part about LLVM is that it is non-GPL and the different approach to compiling when compared to other compilers that are out there especially when you consider the way in which Apple has used LLVM. There are benefits to FreeBSD in that hopefully it’ll also force open source projects to purge GCC’ism’s and GNU’isms out of the code bases so that they’re more platform agnostic which end the end benefits everyone.
I wonder if sometime in the future we’ll see an LLVM compiled version of OpenSolaris and including that as part of the system itself
Don’t bet on it. The reality is that GCC is the king of the hill and LLVM is a second rate-knockoff.
People know and like GCC and aren’t about to go screwing around with their codebases to appease losers like yourself.
The reality is people are coding for GCC nowdays and that’s not going to change as as GCC is actively updated and supported.
As for what the BSD crowd does, who really cares?
They’re the ones who are going to be running into all the grief by using LLVM, not the GCC userbase.
LLVM+Clang has some interesting advantages over GCC, such as more language support, faster compilation time, much friendlier error reporting when compiling (specially helpful when doing templates), and the posibility to to run all the code interpreted.
Another nice feature of LLVM is what is developed by Google in PNACI, which allows its intermediate bytecode to be compiled/run in any platform. This means you can partially compile a C or C++ app, and then the final compilation (or JIT) takes place in any architecture, x86, ARM, etc.
I am pretty sure you are incorrect on this point, IIRC Clang is only a C/C++/Obj-C front end for LLVM, with no aim to support other languages.
While I am sure that LLVM can and will be used for many more languages and purposes in the future, I think that GCC still supports more languages at the present time.
C/C++/ObjC/ObjC++ front-end with a unified parser.
http://clang.llvm.org/
Still GCC does support more.
Where is Java/Ada/Fortran support in LLVM?
GCC supports a lot more hardware platforms, as well as more languages. LLVM supports the most important ones, though, I mean you don’t see a ton of people complaining that they can’t use it with Ada on some random architecture that most people have never even heard of. I think LLVM is being smart by focusing on the core compiler before trying to add too many front and back ends.
They may have meant that Clang has better source level understanding of C/C++/Obj-C and can provide better error messages and better analysis.
Also, I wouldn’t be surprised if there are more languages that target LLVM than GCC. GCC is a sort of ‘monolithic’ compiler, so the only languages it supports are the ones on its homepage. There are many, many more obscure projects and languages that use LLVM. C/C++/Obj-C are just the only ‘official’ ones supported by LLVM.
I really hope you’re joking, because I was laughing at how stupid you sound…
Not really true… LLVM often beats GCC in performance. Sometimes, GCC wins, but it will be a lot easier to improve LLVM due to the more modern codebase.
It’s a compiler. If you write standards-compliant code (which you should be doing anyway), all you have to do is change the Makefile. That’s it.
People code for C/C++, not GCC. Sometimes people use GCC-extensions for convenience, but this can usually be fixed with small changes. It’s not like you have to rewrite your project (ClangBSD is just some small patches on top of FreeBSD). Also, I think that there is probably more work going into LLVM now than GCC (I don’t know if this is true, just a guess).
Um, all the people who use BSD? Apple?
Grief? Like improved performance? Improved compiled compile times? Less licensing hassle?
From my own tests, and those I’ve seen online gcc beats llvm most often. That said gcc is alot more mature and sports a higher amount of optimizations, llvm will catch up in this regard.
Agreed, also llvm adopted gcc’s flags so basically you only need to change CC and LD vars.
I very much doubt this, there’s alot of people working on gcc, and I’m pretty certain that there’s alot more people paid to work on gcc. I know Red Hat, IBM, Suse etc all have people paid to develop gcc. What the future will hold is another matter entirely.
Improved performance may or may not be a result (both compilers will continue to advance in this area) so that remains to be seen. In my tests compile times are better though I haven’t really benchmarked it, but that’s a definite plus. Licencing hassle? Never really understood this since Gcc’s licence doesn’t really traverse to code compiled with it. Also the new plugin architecture makes it possible for 3rd party non-gpl code to use gcc in a convenient way. llvm is alot more modern in it’s core design (although gcc has improved alot in this respect over the years aswell) and is used for some very interesting stuff like jit compiling of shaders etc.
All in all, these are two excellent compilers and they’re both open source and free. Sadly it seems we always end up in a spitting competition between the bsd/apple crowd and the linux/fsf crowd here and it’s so sad. View these compilers technically and for the benefits they give you and your project. Personally for my projects code execution speed is paramount and I will use whichever compiler that makes my code run the fastest. Other projects may have other priorities and choose compiler toolchain based upon that. Having these two great options is a godsend, so why are people bickering and seemingly wishing one would vanish?
Dude, benchmark testing *IS A Total And Complete JOKE* Always was, Always will be.
Only a complete fool takes the results of benchmark testing seriously, especially where things like compliers and videocards come into play and the results are too often bogus.
Heh, are you kidding me? I benchmark a wide range of software which (apart from my own) include raytracers, 3d renderers, emulators, compressors and yes, these benchmarks reflect reality since they are benchmarked for what they are used for. When I get a 10% speed increase in 3d rendering it’s not a pointless benchmark, it means that I will render 10% faster. If I get 15 frames faster in an emulator it means it emulates 15 frames faster. And no, the video card really doesn’t come into play when I do these benchmarks (for those where video output actually makes a difference I rutn it off). All compilers routinely benchmark their code output to catch regressions in optimization and of course to catch faulty code generation.
GCC supports autovectorization, LLVM doesn’t yet. This is why GCC is very superior in stuff like 3D/audio benchmarks.
In theory at least, in praxis you’ll certainly have some bugs in your software after compiling with GCC.
GCC is no problem for Linux. But BSD’s like to have as little GPL code as possible. This is one of the main reasons for ClangBSD, to get rid of GPL code. Personally, I like the GPL, but I totally understand their reasoning.
Compile times with Clang are much, much faster than GCC. In all the tests I’ve done, Clang was faster than GCC. Most of the time it was at least twice as fast. Sometimes it would even be five times as fast. Even if GCC’s output were 10% faster than Clang, I’d still use Clang for most things (especially if I were developing for the Linux kernel…)
Agreed. I don’t get why there is so much LLVM-hate and GCC-hate also. I’d say I’m from the ‘Linux/FSF crowd’, but I use both compilers all the time. Personally, I prefer LLVM due to its more modern design. I also write compilers, and LLVM is much easier to use than GCC’s backend…
Edited 2010-04-17 19:27 UTC
yes, during the development (particularly for large projects) compile time is often paramount. I wasn’t aware that the difference was that big though, certainly makes a good case for llvm. During development I stick to -O0 or -O1 and higher optimizations are only used once final test builds begins so compile speeds are pretty decent but I sure wouldn’t say no to a two to five time speed increase in compilation.
Many FOSS-devs don’t like GCC. One of them is Linus Torvalds. Google for him and his rants about GCC. Google more and you’ll find more problems, Google further and you’ll be happy about any alternative at least if you’re a developer.
Most of Linus’ GCC rants are because of improvements in optimization that the GCC devs made.
Any developer is dreaming if they imagine that other compilers will not do the same improvements.
What Linus wants isn’t an optimizing compiler. It’s some kind of macro assembler. Which, honestly, might be a better choice for kernel development.
Not that I disagree completely with you, but when you write platform specific code of the kind used in kernels and runtime libraries, ie OS-code, you often run off standards limits.
As clang emulates GCC there are not so many problems, but getting old platform dependent code to compile with clang is not as easy as “export CC=clang”.
I haven’t had any problem with standard C, though.
Yes, I definitely would not expect the Linux kernel or GLibC to compile with Clang right away. However, most applications C code should work – if not, the project is probably doing something bad (using non-standard extensions when they don’t need to).
I doubt that, OpenSolaris recently tries to be Linux too much, so they will stick to Linux stuff instead.
Isn’t OpenSolaris built with Sun’s C compiler anyway?
Yes it is, and it has its own userland (besides the GNU userland, which is optional actually). But I assume facts were not a priority for the previous poster.
“A requirement for OpenSolaris is the ability to build a working set of bits using either recent Sun Studio tools or the GNU compiler collection.”
http://hub.opensolaris.org/bin/view/Community+Group+tools/gcc
http://llvm.org/docs/FAQ.html#license
Read up on the two areas of licensing.
Part of the aim of clang is to be compatible with gcc. So it will be used as a drop in replacement, with hopefully minimal impact on the codebase being compiled with it.
I never understood the aversion for gccisms. Can you expand on that?
Here it is:
Clang will be under the more liberal licence since it replaces GCC – so what is the point of your original post then?
Clang is not LLVM. They are separate projects.
And GGC is a seperate product that will provided via dragonegg, so your point is moot. Clang is the default front end for LLVM and included with it; again, your point is move – run along and troll somewhere else.
The less GPL-licensed software in a BSD OS, the better. Especially considering GPLv3 makes it impossible to upgrade a lot of the GPL’d software already in the system.
Since the GCC toolchain has moved to GPLv3, it can’t be upgraded in the FreeBSD base, leaving it with GCC 4.2.1 for eternity.
That’s their choice. GPLv3 is not legally incompatible with BSD operating systems, it’s just that current project leads don’t like the license for one reason or another.
Upside of this is that it gives LLVM some testing & mindshare; downside is that FreeBSD is left behind until LLVM reaches parity with newest gcc.
IANAL but GPLv3 is legally incompatible with a lot of things so it might actually be a legal issue. I know in the mobile industry GPLv3 is about as popular as a case of syphilis, the companies wont use it and the companies they deal with can’t use it either. I personally know people who are forbidden to send out any code even just compiled with a GPLv3 compiler.
Probably not for long. LLVM has mindshare from rather more then just BSD developers. There’s some very big industry players contributing these days.
Sorry, seriously doubt this since the licence of the compiler has no effect on the licence of the generated binary.
Apart from Apple, who are the other big industry players working on llvm? I know Google uses it for certain things but I’m not sure they actually contribute to it.
Edited 2010-04-18 02:09 UTC
I’ll refer you to this page:
http://llvm.org/Users.html
The most extensive user by far is Apple, whose primary goal is to have osx compiled completely by Clang and remove gcc from the equation. See this:
http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/9
Edited 2010-04-18 02:18 UTC
But you are missing the point, we are talking about contributing, not using. Red Hat, IBM, Novell and others employ programmers to work on GCC. I know Chris Lattner is being paid by Apple to work on llvm, and I would gather they have hired some others aswell to work on it, but I was interested in who the other “very big industry players contributing” are apart from Apple.
This makes sense for programs that are actually shipped in the devices. For a compiler, this is a knee-jerk reaction to fud (and I’m somewhat surprised that supposedly competent people fell for it).
There is one valid situation when the compiler license could matter – when you’re embedding it into your own project. For example, writing a graphics driver that dynamically compiles shader programs at runtime. LLVM is also designed specifically for that kind of use, while GCC isn’t, so using LLVM for that is kind of a no-brainer even disregarding the license.
Other than that, for 99.9% of uses it doesn’t. You can compile a BSD program from MS C compiler, or Intel’s, or GCC GPL2 or GPL3 and all still come out as valid BSD software. Doesn’t matter what kind of text editor or compiler you use to create the program. This is not something that lawyers even debate about, it’s not controversial, it’s settled fact.
Edited 2010-04-18 08:58 UTC
What are you talking about?
Majority of the so-called optimizations make no sense with operating systems. Here the correctness matters more (see also Linus’ rants).
For third-party software obtained via the package system, gcc is always available. And will be required.
>downside is that FreeBSD is left behind until LLVM reaches parity with newest gcc.
No, most people are using GCC4.x from ports if they need it.
And to answer your question why there is no GCC under the GPL v3 in base: http://www.freebsdfoundation.org/press/2007Aug-newsletter.shtml#Let…
Finally it’s about the freedom to do what you want to do with this very operating system.
Did I miss it? All I saw in that press release was a bunch of talk about why the author likes BSD more than the GPL, because he thinks it’s more free, and why companies that want to modify code might not like the GPLv3 (but then who actually modifies GCC anyway?).
This is the only part that even impacts what BSD itself is using rather than just marketing towards commercial users:
Listen, I have no problem with the BSD license. I have no problem with LLVM either, although I like it more for the modern design than the license it chose, which I really don’t care about either way. But let’s not spread FUD and just be honest that people are being political when they claim that GCC GPLv3 can’t go into FreeBSD. It’s no different than some linux distros that don’t include any proprietary code for political reasons.
Edited 2010-04-18 20:12 UTC
He doesn’t think it is more free, he is telling a fact. More rules are equal to less freedom. And the goal of any BSD is to give you the possibility to use those operating systems according to your wishes. Remember? _Your wishes_! And if you use something GPL3 from the ports, then it’s your very own decision! The do care about their different kind of audiences. Have a look e.g. on the FreeBSD mailinglists … politics? Good luck while looking for it. Quiet the opposite you’ll see for example on the Debian mailinglist … politics en masse. FUD isn’t a one-way ticket …
I hope that the wonderful group of people that is behind the ClangBSD will delight us with JBSD – BSD compiled for Java VM and BSD.NET – BSD compiled for IL.
Quick Guide for Awesome Open Source Projects:
Decide to get involved in open source
1. Are you bored enough? If not, GOTO 1.
2. Pick a project, any project.
3. Is the project duplicating other project that works well and has success? If not, GOTO 2. (let suckers do some new things, we just want to reinvent the wheel in some new and exciting ways, sky is the limit)
4. Will the project be useless or it will actually have some value? If it’s the later, GOTO 2. (if users want something useful, why should we let them profit from our hard work?)
5. Pick a language, any language.
6. If it’s something known and widely used such as C, C++, Java GOTO 5. (widely used languages are fking boring, we engaged in this project because we are already bored, so be better pick a nice language and unleash the true power of Whirl, INTERCAL or Brainfuck)
7. Pick a platform, any platform.
8. If it’s something widely targeted such as x86, PowerPC, MIPS, ARM, Z80, Cell, Nvidia GPU than GOTO 7. (all losers and their mom can program for x86, but we want to be cool and we are REAL PROGRAMMERS so we might want target something like a bred toaster or hand watch. It doesn’t matter that our project can’t run on a watch or toaster. Think how powerful toasters will be in 2020. 2020 will be the year of toaster powered projects)
9. Search Google for “opensource programming”.
10. Spam as much websites and mailing lists as you can find. Don’t provide any details about the project but be sure to pick a nice title like: “Devs wanted for the world’s most …. and …. project”.
11. If someone will respond, be sure to ask if they have previous programming experience. If they do have, GOTO 10. (make no mistake, programmers with programming experience are likely to be arrogant bastards, they aren’t team players and they have bad programming habits from working with the likes of C and C++. If you can involve somebody who has drawn something in Photoshop or has designed some webpages, do it ASAP. He’s a codding god and will be of high value to the project)
12. Make a new project on sourceforge. (that’s right, sites like sourceforge exists just to provide a home for nice projects like yours)
13. Ask for donations on your sourceforge page. (that’s right, you are hard working so the least thing the community can do it’s to donate some money to buy a new toaster for the project)
14. Already bored by this project? No problem, rinse and repeat.
Judging by the moderation, someone here has no sense of humour at all.