How to build GCC 10/11 on Haiku?

Hi all

I’m a developer of a web application framework and have ported several libraries to Haiku for fun (didn’t release them, they are full of hacks). I want to port the next iteration of the framework to Haiku as an exercise and pet project. To see how much it can work on non-standard environments. But that version requires C++20 (coroutine and concepts) support. Implemented by GCC >= 10. And Haiku supplies 8.3.

Is there a way to manually build newer GCC on Haiku?

Here is the current 8.3 recipe:

Adjust the recie and apply-extend the patchset and build it with HaikuPorter.

Sadly the patchset wont apply cleanly and even if you apply it manually the patches needs to be extended for 10.x, it means you will have to have some knowledge about GCC internals.

Thank you.

Do you know what’s the standard for submitting to HaikuPorter? It’s kinda a waist if I ported GCC 10 to Haiku but can’t let everyone else use it.

The Wiki should contain any relevant info:

One the side from haikuports you can count on some help here, though the basic recipe atm should cover most things, hardest part is on the code/patching side I guess :slight_smile:

I have applied the GCC8.3 patches for GCC8.4.0:
GCC fails to build with it tho.

Maybe you can fix it.

Hello @marty1885!

Welcome to the fight! :slight_smile: Awhile ago I asked the same question on the forum C++20 Support. @extrowerk posted some information there that may help as well.

About the “poisoned variable” mentioned in that thread, from what I was able to figure out, the variable in question has been deprecated and it should be safe to remove it completely.

Using the GCC 8 patch as a base-line, most of the changes were adding conditions for Haiku in the various configure and other build scripts. However, the patch did modify some line numbers in generated code, it looked harmless but probably should be corrected. Also some C++ files are added by the patch.

My first attempt failed because my drive/partition was only 2G. Dedicating a 4G drive to Haiku for porting GCC does not leave much free space available. I would recommend 8G or more when porting GCC. My second attempt failed due to header file issues: not existing or not finding or using the wrong one. Don’t remember exactly. Then I ran out of free time.

I wish you the best in porting GCC, I too would like to port some C++20 code to Haiku.

Thanks @Zakero. I certainlly will try!

I think I’ll start when GCC11 is released. It should be released soon and comes with more features.