
FreeBSD 10 to use Clang, GCC will be deprecated - lysol
http://www.phoronix.com/scan.php?page=news_item&px=MTEwMjI
======
mrich
I have been working on getting a quite complex C++ code base (3M+ LOC) with
heavy template use to compile on clang. Along the way, I have found many
violations of the C++ standard that GCC silently accepts, several obscure GCC
features that clang does not support, and up to now filed three clang bug
reports.

The project compiles now, but the resulting executable is still not passing
basic regression tests :)

I think our codebase has been depending for too long on just one compiler, and
clang C++ support isn't perfect yet. (FreeBSD has mostly C code which is very
stable). I will keep pushing to get it all working :)

~~~
maybird
I'm in the same boat. A large code base relying on GCC and Boost heavily.

The code builds with Clang, but the runtime crashes deep inside Boost.

It's been very frustrating because we're well past the point where
refactoring-out Boost would be cost effective.

~~~
jpdoctor
> _It's been very frustrating because we're well past the point where
> refactoring-out Boost would be cost effective._

I'm curious: What was the motivation for switching in the first place? And why
is staying with the proven tool not the better option?

My own case: It makes no sense to migrate our (relatively small by the sound
of it) codebase. It is in production, generating money, and anything that
interferes with that is simply not going to be considered. Our largest
dependencies are wxWidgets, ffmpeg, libcurl: It has performed well, though not
without some hiccups.

~~~
maybird
iOS.

Apple won't allow us to submit apps built with Xcode 4.1 forever. (4.1 was the
last to include GCC.)

~~~
jpdoctor
_headslap_ Right. I live in a windoze-centric place at the moment (at least
for compile) and forgot the world is bigger.

Thanks for the reply.

------
TwoBit
We have been using clang on Apple, Linus, and FreeBSD. It's a lot nicer to
work with and compiles faster than GCC, including 4.7. As people point out,
the generated code is on average a little slower.

~~~
harshreality
_We have been using clang on ...Linus..._

clang, now with a compile-to-DNA backend.

~~~
javert
No, I think he's saying Linus is a robot. A robot whose software is compiled
with clang.

That implications are disturbing.

------
Turing_Machine
I haven't been following C much in recent years, though I knew that Apple had
switched.

Someone want to give (or link to) a brief rundown of the
advantages/disadvantages?

~~~
MBCook
There is a little bit on the Clang site:

<http://clang.llvm.org/comparison.html#gcc>

Outside the license, the main benefit seems to be that in Clang the different
stages are less intertwined than GCC. This is supposed to make developing
Clang easier (since you don't have to understand so much), allowing
optimizations to be tested and added easier.

On the user side, Clang is well known for providing much better error
messages. Some error messages will even suggest possible fixes (you might get
something like "Can't assign a pointer to a something, did you mean
*pointer?").

The GCC guys have been improving their compiler for a long time, and over the
last few years they have been working hard to make GCC easier to work on and
optimize. I believe that GCC is usually faster or the binaries are smaller by
a few percent, but it's not generally a drastic difference.

~~~
supar
GCC speedup is actually quite substantial in math/numerical code (which, in
turn, is not as fast as Intel's ICC). Moreover, GCC supports OpenMP, whereas
Clang does not. This alone make building several scientific software packages
not possible with Clang.

It's important to note though that it has only been recently (starting with
GCC 4.4) that I've started to see some _improvement_ over previous GCC
versions. GCC 3.x was known to be bloated, buggy and emit poor code for almost
every architecture. Open64 was superior in _all_ regargs up to GCC 4.2/4.3 in
my opinion.

Clearly, the whole project greatly benefited from Clang's competition.

~~~
gillianseed
Agreed. Competition is GREAT, and seeing these two excellent open source
compiler offerings engaging in friendly competition means we as end users all
benefit, no matter which solution we prefer (or use both, as I assume I'm not
the only one doing).

------
maxharris
I'm excited about this change. I was working on a C++ project last summer that
had a lot of templates. Clang was a _lot_ faster, and a lot easier to use.

------
mp3geek
Would be interesting to see benchmarks with GCC vs Clang in FreeBSD

------
soc88
Aren't they pretty much doing anything these days to make it easier for Apple
to “steal” their code, considering that most consumers of BSD code are Apple
users?

~~~
drostie
As someone who tends to release on more-permissive licenses, I just want to
clarify the causal model here.

It's not "doing something extra" to release with BSD; the "doing something
extra" comes when you want to properly release with GNU.

After a long random walk over the licensing attitudes graph, I have found
myself for the last several years stably located at one node. This node is,
"licensing is about lawsuits." People often release with the GNU GPL because
licensing, for them, is not about lawsuits but has some other import and use
-- perhaps moral. But for me, a license is strictly about defining what sorts
of lawsuits are possible.

Copyleft is a threat to sue. More precisely, it is the threat "I may sue you
if you don't threaten to sue others." And that just sounds crazy. Why would
you do that? Well, the stated goal of copyleft is to eliminate all fears of
lawsuits by using legal threats.

Let me hasten to add that this is a very pretty idea. If you know the
religions of India, this idea is called _tantra_ \-- that sometimes the most
precise tool for removing a thorn is other thorns, or sometimes the best way
to remove dirt from your clothes is with an abrasive substance -- like other
(cleaner) dirt. The reason that Stallman is sometimes described as religious
may come back to the attendant mysticism that tantric approaches usually bring
with them.

My point is, this sort of thinking is an active choice and requires you to
enforce the threat, at least in principle. The BSD license is much simpler: it
says "I won't sue you, and you're not allowed to sue me." It is a Buddhist-
nonviolence approach to eliminating lawsuits: "I have stopped causing
suffering in this world, Angulimala -- now why don't you stop?"

It is nothing extra to release this way: you simply promise to not sue anyone,
and you only give permission conditional on the fact that they will not sue
you, you write it once and then it is done. It's clean and elegant. If you
want to actually be a productive GPL licenser, you have to either hope that
the threat in the docs is enough, or else find everybody who is "conveying"
your software, and slap them with a lawsuit so that they learn how much
lawsuits suck.

~~~
udp
An upvote wasn't quite enough here:

This is a lovely way of explaining the difference, and it'll be what I link
people to in future when explaining why I opt for BSD-style licensing. Thank
you.

~~~
cygx
As lovely as the explanation may be, it focuses on a single issue. The whole
point of the GPL is granting and protecting end-user rights - protecting the
developer from lawsuits is a secondary concern.

~~~
udp
What end-user rights does the GPL grant or protect that the BSD license
doesn't?

The right to do whatever the hell they want with the code is granted by the
BSD license. I wouldn't say the same for the GPL.

~~~
cygx
The end-user is not the developer who re-uses GPL'd code, but the guy who uses
the final program.

By licensing code under the GPL, you grant the end-user the right to use and
modify any program using your code as he sees fit (as long as he adheres to
the rules of the GPL on re-distribution), and no intermediate developer can
legally take that right away.

Of course this restricts the freedom of indermediate developers, but the GPL
is intentionally -Ouser, not -Odeveloper. It just so happens that some users
are also developers.

------
Sicp
WAT.

~~~
unimpressive
Wheres the "WHAT?!". The BSD guys have gone on record multiple times saying
that they think that RMS and GNU are a joke. It seems natural that they would
try and phase out GNU when possible in light of this belief.

An example: <http://openbsd.org/lyrics.html#43>

You can even download an MP3 or Ogg of it being sung (With backing.) by Nikkos
Diochnos.

~~~
lhnn
That's a pretty scathing critique.

~~~
unimpressive
For bonus points, in the actual recording they note that Hypocrites "Smells
like thousand year old goat cheese.". which no doubt refers to Stallmans's
legendary hygienic practices. [0]

Needless to say, the BSD guys aren't really fans.

[0]: <http://www.youtube.com/watch?v=I25UeVXrEHQ>

~~~
diminish
Yea, most BSD guys I know are also fans of Apple; iOS and Macs on desktop
rather than GNU or Linux and Clang is supported by Apple for license reasons.

