GCC 6 and the status of compilers in OpenIndiana

Last year we added GCC 5 to our main repository to allow for broader testing and prepare for future userland compiler migration: changes in the C++ ABI for example call for careful testing.

As an increasing number of open source projects requires support for C11 and C++11,  adding GCC 5 made possible the integration of software with such requirements in our unified build system oi-userland: for example MongoDB was added.

Recently we packaged GCC 6 as auxiliary compiler, for testing purpose but also to provide features required by recent software (e.g recent OpenMP specifications).

This is a good opportunity for reminding the status of compilers in OpenIndiana.

Which compilers are used in OpenIndiana?

When it comes to compilers the picture in OpenIndiana is a bit more complex than on other systems as different compilers coexist:

  1. GCC 4.4-illumos is used for the compilation of illumos-gate, the core element of the operating system. This version of GCC contains modifications required for building illumos and has been thoroughly tested. It is installed in ‘/opt’ on every illumos system.
  2. GCC 4.9.4 is our userland compiler i.e. it is used by default for building all the packages on OpenIndiana, including some extra kernel drivers. This compiler is unmodified, and installed in /usr/gcc/4.9 with runtime libraries visible system-wide in /usr/lib.
  3. GCC 5.4 which was introduced last year comes as a supplement: the userland compiler may be missing features or present bugs known for breaking specific software, like alignment issues. This compiler is installed in /usr/gcc/5 and we provide symlinks in /usr/bin for convenience.

With the introduction of GCC 5, we can catch compilation issues for different userland components in a testing environment.

What is new with recent compiler packages?

Another reason for introducing recent compiler versions is to prepare the migration to newer toolchains for illumos itself.

The idea is to provide a development sandbox for illumos so that people can experiment with newer GCC versions and possibly catch compiler-related regressions in the process.

The novelty in the GCC 5.4 and GCC 6.3 packages introduced a few weeks ago is that they include GCC-illumos modifications necessary for building illumos-gate.

This does not mean that illumos-gate will build out-of-the-box though: some changes are required in the illumos source to support recent GCC, and they are exactly the motivation behind this development playground 😉 Work with GCC 6.3 is ongoing and should be integrated in the future.

What are the challenges for userland compiler migration?

As our userland compiler is showing its age, we need to spin testing environments and perform full rebuilds of oi-userland.

There are several issues to solve on the way:

  1. Missing build dependencies: if the testing environment does not provide the entire repository, the rebuild may be hindered by missing build dependencies. Most of them are taken care of automatically by our build system, but header-only packages tend to fall through the net. If it is the case, the missing package should be appended to the REQUIRED_PACKAGES variable in the component’s Makefile.
  2. Broken software: our userland contains software old enough to cause problem with recent compilers and require patching. Some known issues in GCC 5.4 and 6.3 also produce false-positive warnings, which turn into hard error if pedantic compilation is set.
  3. ABI compatibility: the biggest challenge in this regard is the change to the GCC C++11 ABI which will require iterative and time-consuming rebuilds.

People packaging software in oi-userland may consider testing their builds with GCC 6 so that we can migrate incrementally whenever possible.

The procedure should naturally start from the minimal incorporation and be extended — step by step — to the desktop bits.