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.

2 Likes

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: haikuports/sys-devel/gcc/gcc-8.3.0_2019_05_24.recipe at master · haikuports/haikuports · GitHub
Current GCC patches: haikuports/sys-devel/gcc/patches/gcc-8.3.0_2019_05_24.patchset at master · haikuports/haikuports · GitHub
Binutils: haikuports/sys-devel/binutils at master · haikuports/haikuports · GitHub

2 Likes

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

3 Likes

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!

18 Likes

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.

13 Likes

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

10 Likes