By Jake Edge
October 24, 2007
A C compiler with a long history in the BSD world has recently been imported into the package
repositories of the major BSD variants. There are thoughts that it
may, perhaps,
replace GCC for BSD development some day. A competitor to GCC might be
very well received in some parts of the Linux community, as well – grumbling about the compiler, its speed, and the
code it generates have been heard for some time.
The Portable
C Compiler (pcc) came from Bell Labs in the 1970s and shipped with
4.3BSD-Reno. It was eventually replaced by GCC in 4.4BSD, but it is a much
simpler compiler than GCC, while still targeting many architectures. More
recently, most
of the compiler has been rewritten by Anders Magnusson and others. It will
currently compile many of the BSD userspace programs, even linking to
libraries compiled with GCC. It is also available in RPM format for Fedora
Core 6 and Fedora 7.
Interestingly, pcc has Caldera copyrights as part of its license; well
before they became the SCO Group and sued their way into pariah-dom,
Caldera released "ancient Unices" under a BSD license. pcc is BSD-licensed
as well, which has some obvious attraction for the BSD world, but licensing
is not the primary motivation. The reasons for working on an alternative
compiler are more complex, with OpenBSD leader Theo de Raadt saying that one
of the reasons is
"fighting against an open source monopoly."
There are several big issues with GCC for the BSDs, but regularly breaking support
for architectures that they still use seems to be one of the biggest. The
feeling is that GCC concentrates on Linux for x86 and PowerPC to the
detriment of other operating systems and CPUs. By having a compiler whose
developers are more aligned with the goals of the BSD family, those kinds of
problems can be avoided.
The GCC development process can be politicized and difficult
for developers – the GNU coding standard can be a real
barrier for example. Each new release comes with its set of new features,
but with new bugs, especially in the optimizer, that make it difficult to
adopt. Supporting multiple GCC versions for a codebase can be an enormous
headache. Marc Espie, GCC maintainer for OpenBSD, outlines
multiple frustrations with GCC while advocating a new compiler.
The speed of compilation is another area that GCC is criticized for.
With each new release, GCC is typically slower, sometimes much slower, in
doing its job. Currently pcc is five to ten times faster – a big
difference for developers who are constantly recompiling code.
Some of the complaints are reminiscent of those that led to the GCC/ECGS
fork, but instead of forking, the BSD folks are investigating an entirely
different codebase. Another big barrier to developer involvement in GCC
coding is its complexity. GCC is huge and quite daunting to
someone who just wants to start hacking on a compiler. It is also difficult to
audit for security, one of the hallmarks of the OpenBSD project. pcc is
small, easier to understand and audit.
GCC is an important piece of the free software world, it has been for
decades and will be for more in the future. It has enabled most of the
software we use every day and for that we should be grateful to the GNU
project and the GCC developers. It is not without its warts, however; a
competitor might just bring about some changes.
pcc is still a long way from supplanting GCC, even in places that would
like to see it happen soon. It will be interesting to see – and good
for both Linux and the BSDs – if pcc can get to the point of being a
viable competitor. Some worry about forks and multiple projects with
similar goals (i.e. GNOME and KDE) because they may dilute the efforts of
each branch, but that concern has proven to be largely unfounded. Either
the technically superior project wins out, or they all coexist more or less
happily.
de Raadt is right to be concerned about monopolies, free software or
otherwise. Two – or more, see the LLVM
project for another option – C compilers can only be good for the
free software world. A variety of approaches to both code and project
governance allows more participation by more developers. If some day pcc
is clearly the superior choice, GCC will change or fade away. That is free
software Darwinism at its best.
(
Log in to post comments)