I don't use Ubuntu very much, being a platforms and builds engineer in an organisation that's primarily Red Hat Enterprise and its work-alikes.
The problem with just building and using an up-to-date GCC is the language run-time libraries. I would either have to distribute them, complicating shipments and making the lawyers nervous about GPL, or require my customers to build and install the same GCC.
I produce closed-source commercial software, mostly mathematical modelling, compiled from C and C++ source and shipped as shared libraries. This means I'm extremely interested in achieving cross-distribution binary compatibility. This is practical because everything my libraries need is available from glibc and the GCC language run-times (libgcc_s.so.1
and libstdc++.so.6
). Both those sets of libraries have very strong forwards compatibility, due to all their symbols being versioned, and new versions being created every time there's a behaviour change.
At present, I do my builds on RHEL 8.x. This has fairly old GCC (8.x) and glibc (2.28), so if I built my libraries using it naively, I'd have forwards compatibility to Linuxes with equal or later versions of those libraries. However, that old GCC doesn't handle the C++20 language standard, which the developers very much want to use, still less the new C++23 standard. RHEL provides a solution for this, but I haven't found anything similar for Ubuntu.
The Red Hat solution is a "GCC Toolset". There are a range of these, but they all work the same way. They provide a later version of GCC, built to run on RHEL 8.x's run-times, the standard headers, and some special scripts for GNU ld
. Those scripts tell the linker to use the system libraries for the GCC language run-times where possible, and for functions that aren't in the system libraries, statically link the required code into the shared library (or executable) being linked. This sounds scary, but works extremely well. This is probably because Red Hat are major contributors to GCC and make sure it stays working.
Does Ubuntu have anything similar? I would like to have an alternative to Red Hat, in case their exploitation of GPL loopholes succeeds in stamping out the work-alikes for their OS, which is too expensive to run on every single test machine.
My current knowledge of Ubuntu compiling and run-times is explained in my answer to a related question here.
For the C++20 case, moving to Ubuntu LTS 22.04 would fill the need. However, C++23 is starting to appear. We can expect Ubuntu LTS 24.04 quite soon, but it will likely be too early for the C++23 support in GCC 14, due to be released in April or May 2024. I'm making the assumption that "Enterprise" Ubuntu customers will only install LTS versions on their main servers, rather than the intermediate versions.
If Ubuntu doesn't do this, that's OK. Given it's an Enterprise Linux, I thought I might be missing something.