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?

1 Like

Here is the current 8.3 recipe:
https://github.com/haikuports/haikuports/tree/master/sys-devel/gcc

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: https://github.com/haikuports/haikuports/wiki

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: https://gist.github.com/extrowerk/b8e6f7bf543e4b1917b0974304d2ad65
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.

I migrated the Haiku patches and built GCC 10.3.0 on Haiku. GCC 11.1.0 is the next build.

gcc_debuginfo-10.3.0_2021_04_08-1-x86_64.hpkg
gcc_fortran-10.3.0_2021_04_08-1-x86_64.hpkg
gcc_syslibs_devel-10.3.0_2021_04_08-1-x86_64.hpkg
gcc_syslibs-10.3.0_2021_04_08-1-x86_64.hpkg
gcc-10.3.0_2021_04_08-1-x86_64.hpkg
3 Likes

Sadly you decided to not publish the adjusted GCC10 recipe, and what you published earlier not builds on nightly, it doesn’t packages because the sonames doesn’t match, and the patchset is a mess.

You are free to make hype, but do not forget to deliver.

Also we cannot build GCC11 on Haiku currently because https://review.haiku-os.org/c/haiku/+/3890

Whatever, i built GCC 10 on a nightly.

Kép

Built openblas and fftw3 with it, seems to be working.

4 Likes

Sorry I haven’t tried to build GCC myself as GCC 11 hasn’t been released yet.

@extrowerk May you share your build scripts and patches? And hopefully you can add those patches to haikuporter.

Thats the plan, yes.

It was released a WHOLE two days ago. :wink:

Either of us will do that. As for patchset, recipe, and other comments, all of that was fixed.

There are no NIGHTLY buildbots - only HAIKU R1B2 buildbots. I’ve already ticketed the current issue with the existing GCC 8.3.0 recipe.

GCC 10.3 will provide the C++20 requests. GCC 11 is a bit better.

1 Like

Maybe we could work together if the task turns out too hard/large? I’m waiting for @extrowerk’s patches to be uploaded. It would be a better starting point than the current GCC 8.3 patches.

?

2 Likes

You should now be able to build the GCC11 recipe for yourself: https://git.haiku-os.org/haiku/commit/?id=144f45a030014cd10f7bacef223a1bf7e82a58f8

Please test it if you can.

3 Likes