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!"
I'm just so HAPPY!
Don't be apathetic. Procrastinate!
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.
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.
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.
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).
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).
It has a pretty good static analyzer.
Could you elaborate on the "economic reasons" certain categories cannot be released as free software?
Certainly. I've started on this essay.
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.
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. "
Low Level Virtual Machine. However, has little to do with what it is now: http://en.wikipedia.org/wiki/LLVM
Rename needed, certainly, it is.
Carry on.
Anything is possible given time and money.
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).
I have been happily using clang++ at work for a while now and am thankful for the efforts in creating a real world-class open-source compiler suite! Glad to see FreeBSD become ever-freer!
Brian Fundakowski Feldman
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.
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.
Clang is in the order of 10 times faster than GCC (compilation speed) and the generated binary is 1% faster than GCC (so essentially the same but saves hours of compile-time per day on 50MB+ C-files).
Bullshit. It's compilation is at most 1/3 faster, and on most cases I checked, the result executes between 5-25% slower. The former seems to be pretty constant everywhere, the latter strongly depends on the code base in question, with huge outliers both ways.
The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
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
Not really true. Everyone was pretty comfortable living along-side GPLv2-licensed software for many, many years. But NOT the new GPLv3. Organizations all over the place are running away, screaming, from anything using that extra-restrictive and incompatible license. The FSF, developing the GPLv3 license, has done more to promote BSD/MITX licensed software than anyone else could have ever hoped to.
Some companies just keep their older, GPLv2 licensed software as long as they can, but in compilers in particular, age and lack of development is a liability, so they eventually have to go out and look for more liberally licensed projects that will make a reasonable replacement. Hence LLVM has seen a flood of development effort.
Secondly, with the change from gcc-2.x to gcc-3.x and now 4.x, compile times have climbed significantly, in favor of optimization. Even if you turn off all the options you can, you're talking about a substantially longer build time. Not an issue for your final compile for public consumption, but during development, where folks want to quickly compile an test, it's a real nuisance, which numerous develops have been complaining about.
Apple, FreeBSD and many others went for LLVM. OpenBSD went for PCC instead.
Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
Is it possible to build KDE with LLVM?
The main advantage of LLVM is that it will provide much needed competition for GCC which for the last decade has only had VCC to spur it on. Note that LLVM code can be freely transplanted into GCC while the reverse is not allowed, probably enough in itself to ensure GCC's continued preeminence even with Apple's fat checkbook backing LLVM.
When all you have is a hammer, every problem starts to look like a thumb.
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.
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.
on most cases I checked, the result [with Clang] executes between 5-25% slower.
I recompiled a large audio processing code base in Clang and the result was about a 2-3% speedup, with no problems. I immediately switched to using Clang for all release builds. (I still use GCC for debug builds.)
lf(1): it's like ls(1) but sorts filenames by extension, tersely
Another option is to switch from hard drives to SSDs since that handles the bottleneck at its source: time spent seeking to a track.
This guy clearly has no idea what he is talking about.
"His name was James Damore."
I think it comes down to what you define as free software. The Stallman approach is of course very popular, but some say that's actually a bit more non-free since it restricts users of the source code and using BSD is in that sense more free. And it works well. Apple for example is using lots of FreeBSD in their operating system, and they contribute back.
Who would put a compiler as part of their software (either FOSS or otherwise)?
Implementations of the Java virtual machine, the Common Language Runtime (.NET virtual machine), the ActionScript engine in an SWF player, the JavaScript engine in a web browser, or a shader engine in an OpenGL implementation need to compile platform-independent bytecode into platform-specific native code.
Apple for example is using lots of FreeBSD in their operating system, and they contribute back.
Careful, pointing out that Apple contributes back to FOSS will get you lynched on /.
Pointing out that Apple releases their OS kernel under an open license, as well as pays to develop CUPS, WebKit, and LLVM/Clang, will result in them pissing on your grave.
There really are far too many GPL extremists whom condemn any software that doesn't fit into the GPL orthodoxy, even if they use alternate free software licenses. It's almost comical how much it has in common with the Catholic persecution of the heretical Protestants - only this time, it's with a software license of all things.
The BSD and Apache licenses are good examples of non-copyleft, free licenses, and in all honesty, they don't have to worry about compelling developers to contribute their changes because of simple economics: It's prohibitively expensive to maintain a closed fork, and is almost always much cheaper to just contribute the code upstream voluntarily. It's a different mechanism than the GPL's, but it still works very well.
-- Sometimes you have to turn the lights off in order to see.
Yup. In many ways, FreeBSD probably has more desktop users than Linux does; it's just that FreeBSD is renamed "OS X", and has a bunch of additional software dropped in. In many ways, OS X is FreeBSD with a set of additional proprietary userspace interface and API's dropped in.
And yet, in spite of OS X being a 'closed fork', Apple still voluntarily contributes a substantial amount of code back to FreeBSD. To me, it's proof that the BSD license works well, and that compulsory contribution isn't the only way to get those who improve your code to send the improvements to the community. It's also proof that "closed forks," while technically possible, are practically non-existent: Even Apple can't afford to maintain a closed fork, so they contribute code back upstream.
Sadly, there are far too many on ./ that let their emotions get in the way of factual reality, and focus on what might happen, instead on what actually does happen. Much like how the MPAA worries about how DeCSS could be used to facilitate piracy, even though in most cases it's just so we can watch our own DVD's.
-- Sometimes you have to turn the lights off in order to see.
Sure.
1) Clang(++) produces better error messages. This is a mere nicity when dealing with C code, but it's an absolute requirement when dealing with template based C++.
2) Clang has a much more comprehensive set of warnings that get into static analysis of your code than gcc.
3) Clang is modular, and can be used to develop other tools using the same parser/type checker/...
3.1) Because of this, it's been used to develop a static analyser that can be seperately invoked (because it runs substantially slower than the compiler alone) which comes up with even more nice warnings.
3.2) Same again, but for a dynamic analyser which is in development, and does what valgrind does, and more, but without the 20 times slowdown, and with more accuracy.
4) Clang is not specifically designed with stopping it being useful to other developers in mind (RMS has very explicitly stated that one of the design goals of gcc is to make it hard to take apart and use different bits to do useful things in other tools).
5) Clang, when invoked with -O0, runs faster than gcc, for C code, 5-10 times the speed, for C++ code 1-2 times, and produces similarly optimal code to gcc -O0.
6) Clang, when invoked with -O3 or -Os produces faster code than gcc (though not by much).
7) Clang's license is more friendly than gcc's
Basically, clang is all round better than gcc.
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.
Darwin can be left open because there is so much closed source stuff atop it before one can use darwin to make a competitor to OSX.
That seems to be a strawman. The stuff on top of Darwin is neither BSD nor GPL, its not relevant. The fact remains that modified BSD code used by Apple is given back. Other corporations do so as well.
I still think that those selling services based on improved OSS are not following the spirit of the earlier GPL, so again not a good point.
The spirit of BSD is also to give back and share, and various corporations do follow this spirit without any arm twisting.
Incremental parsing means that you don't re-lex/re-parse the entire text stream from the beginning every time a character or two get inserted because of user typing something. Which means that you have to have a lexerthat's smart enough to correct just the few affected tokens, and then a parser that looks at those changed tokens and updates only the affected part of the AST. Which, generally speaking, is not at all a trivial thing, especially for a language as complicated as C++ (where a single token change on one line can result in a variable declaration becoming an expression on a line in a different file).
There are also economic reasons that Android replicates a lot of internal Linux APIs in order to get out from under the EXPORT_SYMBOL_GPL() so it can have faster/closed source graphics drivers.
Look, I most recently worked for Google on the ARM ChromeBook that Samsung recently announced. In the process, I did bring-up on the cellular modem and the camera, fixed the PMIC code, and did other things that ended up in the Linux Samsung 5250 board support, as well as rewrote the i8042 keyboard driver in u-boot in order to let it support ANSI 3.64 escape sequences for keys that couldn't be repreented by a single keycode. I also did work on the embedded controller and touchpad integration in the older original commercial Chromebooks from Acer and Samsung both.
I also filed for two patents.
Linux gets a lot of tactical development being released for free, and it gets a lot of strategic development that remains closed source. Just like much of the original Tivo work, and just like the actually high performance 3D nVidia support, all of which are also closed source.
A company which "gets" open source development "gets" that you give away the tactical stuff so that you offload your maintenance, and you hold the strategic stuff very close to you so that you can continue to afford to pay developers to work on stuff.
Google is in a fairly unique position in that most of the people playing with open source inside Google aren't supported by amortization of their work product, but instead are supported by advertising revenue. Frankly, most of them are not contributing to Googles bottom line (and I did not kid myself about this; I did some outstanding work, but probably the patents which could be used defensively if applied to phones or tablets was my biggest contribution to the bottom line).
So yeah, nice work if you can get it, but not something that generally generates revenue, and I know for a fact that there is a lot of code that Google has been struggling to get into Linux for many years (e.g. the virtual TSC resynchronization code for AMD processors, for one).
And the claim that BSD doesn't get a lot of commercial development is also BS.
I was on the Core OS kernel team at Apple for 8 years, and was the primary kernel person involved in getting Mac OS X's UNIX certification. Inside Apple, you are not allowed to write papers for external publication, or books, without a VP signature, and you are unlikely to get one, so even if things don't get crowed about, there's a hell of a lot of commercial effort going into BSD there.
Juniper also does a lot of commercial BSD development, and so do 3 of the top 4 L3/L4 switches and load balancers.
You just don't see it because people who Mention features or use" of BSD licensed code, at least for the traditional BSD license, have to give credit when they are claiming a specific feature, and so rather than bother, most companies simply don't mention it.
The 'lack of interest' argument applies to both BSDL and GPL projects - go the the GNU software page - how many of those projects do you think are very actively pursued? In either case, the authors can die, and the archived copies, despite being 'free', can go offline. The only thing ensuring the success of any open sourced project is a combination of developer interest in developing them, and corporate interest in promoting them.