C++20 Support

I would like to make Haiku my main development platform for some of my projects, however I need a C++20 compliant compiler. There are other issues but the compiler is the main blocker. On Linux (SUSE Linux), I am currently using g++ version 10.2.1.

The latest version available in the HaikuDepot is g++ 8.3.0. I took a look at what may be needed to create a new g++ recipe/package and I think I can build something locally.

But what else is needed?

  • Does the current g++ recipe include the linker or is that separate?
  • What about the C++20 compliant headers?

Any help or links to information would be appreciated.


I think the binutils recipe provides the linker.

I have tried to bump the GCC recipe to 10.x, but the GCC 8 patches doesn’t applies cleanly anymore, some parts of it should be redone. I applied most of them manually, but then got an error message during compilation, that some variable were poisoned. Now i don’t know too much about the psyché of compilers, so i abandoned the ship.

Good luck, and if it is possible, create a GCC10 recipe and make a PR at HaikuPorts.

Current GCC recipe: https://github.com/haikuports/haikuports/blob/master/sys-devel/gcc/gcc-8.3.0_2019_05_24.recipe
Current GCC patches: https://github.com/haikuports/haikuports/blob/master/sys-devel/gcc/patches/gcc-8.3.0_2019_05_24.patchset
Binutils: https://github.com/haikuports/haikuports/tree/master/sys-devel/binutils


You would try with -std=c++2a on gcc8.x


Thank you for the suggestion. However using the -std=c++2a option with gcc8.x does not support enough of the C++20 for my projects.

Thank you for the links and sharing you past experiences! The information will be useful as I try to get GCC10 work as time allows.

You can use llvm9 - pkgman install cmd:clang_9. It is an alternate compiler to GCC.

GCC11 and supporting C++20 headers are now available in HaikuDepot due to the efforts of @extrowerk and a nudge to get it released by @PulkoMandy.

Thank You!


That’s excellent news. For my projects I’ve enabled some C++20 features on 8.3 with -std=c++2a (8.3 was released in Feb 2019), and I don’t feel that I’m missing out on any must-have features. However, with GCC11 which has an Aug 2021 release, Haiku really become cutting edge regarding available toolchains. Most of the Linux distros ship with Gcc10, so we’d be more up to date than the mainstream OS’s. :slight_smile:

Great work by Haiku porters.


The latest nightly image now ships with Gcc 11 as the default. I’ve updates, and I’ve also compiled my apps, and so far so good … Great work Haiku porters