Freebsd – Why does FreeBSD use the GPL-licensed GCC

compilingfreebsdgccgnulicenses

Why does FreeBSD use GCC as its default compiler?

I am under the impression that a core pillar of the FreeBSD philosophy is not to use any GNU software and in particular, GPL code.

Yet GCC which is both GNU and GPL comes bundled with FreeBSD.

Why?

Best Answer

FreeBSD 10 will use the BSD-licensed Clang compiler instead of GCC for 32- and 64-bit Intel x86 systems. The only thing preventing a wholesale switch on all CPU platforms FreeBSD releases on is developer time and interest.

As for FreeBSD 9 — which was just about to be released when this question was first posed — there was talk about making Clang the default compiler, but there were enough problems with it that they decided to ship Clang alongside GCC, and leave GCC the default for this release.

As for why FreeBSD didn't try moving to a non-GPL compiler years before, or perhaps even create their own, the reason is simple: it's hard.

Any undergrad CS student can write a compiler — it may even be a course requirement — but writing a good compiler is hard. Writing a good compiler is harder still when it needs to be for a language like C or C++. The task becomes still harder when you make the reasonable decision that the new compiler needs to at least approach the performance and capability of GCC, which has a couple of decades worth of development behind it.

Because of that, GCC 4.2 is still the default compiler on FreeBSD 9.

GCC 3.4, 4.4, 4.6, 4.7, and 4.8 are in the FreeBSD 9 Ports tree, by the way, and some version of GCC is likely to remain in Ports for many years to come. There's a lot of software packages out there — many of which are in FreeBSD Ports — which only build with GCC.

Related Question