Compiling the whole Debian archive on MIPS with GCC 4.1
Over the last 2.5 weeks I have built the complete Debian archive
on a quad-core MIPS machine donated by Broadcom using the recently
released version 4.1 of GCC. In parallel, I have done the same
on an EM64T box donated to Debian by Intel. The purpose of this
exercise was three-fold:
- Find out about compiler problems in GCC 4.1 itself as well as in
packages that may fail with the new version before GCC 4.1 is
uploaded to unstable. GCC, in particular G++, is becoming stricter
regarding adherence to standards and packages may fail to build with
4.1 due to invalid code that was accepted previously.
- Find out about MIPS specific problems in GCC 4.1 and to answer Matthias
Klose's question as to which platforms can move to GCC 4.1 as the
default compiler once it is uploaded to unstable.
- Find MIPS specific assembler warnings and create a list of all
users of xgot (a MIPS specific toolchain problem).
Executive summary
GCC 4.1 itself appears to be very stable, both on MIPS and AMD64.
There are, however, a large number of packages using code (especially
C++) which GCC 4.1 treats as errors. Fortunately, most of them are
trivial to fix. By compiling about 6200 packages, over 500 new
bugs have been discovered and submitted, 280 of which are specific
to the increased strictness of GCC 4.1. Patches for 2/3 of those
GCC 4.1 specific bugs have been submitted.
Based on my findings, Ben Hutchings has prepared a summary
of the most common C++ syntax errors (that weren't treated as
errors before G++ 4.1).
Most common programming errors
Basically, it all boils down to broken C++ code. There were a few
bugs in C code, but the majority was in C++. The most common errors
I found are:
- extra qualification
- reliance on friend injection
- wrong escape characters (e.g. "\.", most commonly seen in
regular expressions)
- iterator problems (such as assigning 0 or NULL to an iterator)
- template specialisation in wrong namespace
- template reliance on a function declared later
- use of template's base class members, unqualified, where the base
class is dependent
- use of assert without #include <cassert>
- dereferencing type-punned pointer will break strict-aliasing rules
(a warning) combined with -Werror
I've posted a detailed
report to debian-devel.
Acknowledgements (abridged)
- Broadcom for supporting our MIPS port through the donation of
hardware to the project and developers. Without Broadcom, our little
and big endian MIPS ports would have a hard time meeting the release
criteria regarding autobuilders.
- Google for supporting my PhD, thereby allowing me to spend two
weeks compiling the archive with GCC 4.1 and sorting out
failures.
- Intel for supporting some PhD work which led to this
experiment.
- Ben Hutchings for explaining many of the C++ bugs I found to me.
I've learned more about C++ in these two weeks than I ever wanted to
know. ;-)