Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to C++20 #6484

Merged
merged 1 commit into from
Sep 1, 2023
Merged

Switch to C++20 #6484

merged 1 commit into from
Sep 1, 2023

Conversation

glebm
Copy link
Collaborator

@glebm glebm commented Aug 19, 2023

For x86 and x86_64 builds, we use GCC 13 from ppa:ubuntu-toolchain-r/test (glibc requirement remains the same).
For aarch64, we use Ubuntu 22.04 (which also comes with GCC 13) because aarch64 cross compilers are not available in ppa:ubuntu-toolchain-r/test.

Aarch64 Linux is the only platform that requires a newer glibc with this PR.
We expect that Raspberry Pi OS based on Debian 12 Bookworm will be released within a month or so, well before the 1.6.0 release.

Note that the PS Vita SDK still uses GCC 10.3.0 which doesn't have full C++20 support (but it's still pretty decent https://gcc.gnu.org/projects/cxx-status.html).

@AJenbo
Copy link
Member

AJenbo commented Aug 22, 2023

You think we can maybe update the compiler but keep the same libc 🤔

Feels strange having Linux support be the thing that holding everyone else back.

@glebm
Copy link
Collaborator Author

glebm commented Aug 23, 2023

@glebm glebm force-pushed the cpp20 branch 3 times, most recently from c8c3f5d to 78e05f9 Compare August 23, 2023 03:43
@glebm
Copy link
Collaborator Author

glebm commented Aug 23, 2023

One blocker is that ubuntu-toolchain-r/test PPA does not have the Aarch64 cross compilers.
I've messaged the PPA maintainers asking them to add cross compilers.

@glebm
Copy link
Collaborator Author

glebm commented Aug 27, 2023

Maybe we can use 22.04 just for the aarch64 build?

Ubuntu 22.04 glibc is version 2.35
Debian 12 Bookworm is 2.36

Raspberry Pi OS is currently Debian 11 (glibc too old) but an unofficial Debian 12 image is already available at https://raspi.debian.net/tested-images/ (https://raspberrytips.com/install-debian-on-raspberry-pi/)

@AJenbo
Copy link
Member

AJenbo commented Aug 27, 2023

Maybe we can use 22.04 just for the aarch64 build?

Would it be tied to the newer libc? Probably not then, I think Raspberry Pi people are already pretty shocked it's not 32bit

@glebm
Copy link
Collaborator Author

glebm commented Aug 29, 2023

Yeah it would be tied to the newer libc.

Official Raspberry Pi OS based on Bookworm will probably get released within a month or so though.

@glebm glebm force-pushed the cpp20 branch 2 times, most recently from 0395144 to 3ef9b28 Compare August 30, 2023 08:26
@glebm
Copy link
Collaborator Author

glebm commented Aug 30, 2023

I'm pretty sure that by the time 1.6.0 is released a Bookworm-based Raspberry Pi OS will have already been released, so how about we just go with Ubuntu 22.04 for the aarch64 build?

@glebm glebm marked this pull request as ready for review August 30, 2023 08:40
@glebm glebm enabled auto-merge (rebase) August 30, 2023 08:41
@AJenbo
Copy link
Member

AJenbo commented Aug 30, 2023

My issue with that is that Pi owners appear slow to upgrade there os

@glebm
Copy link
Collaborator Author

glebm commented Aug 30, 2023

Well they can always compile from source, it's easy and Pi users are tinkererers

@AJenbo
Copy link
Member

AJenbo commented Aug 30, 2023

Some re pretty new to tinkering. But won't it fail to compile from src if we bump the requirement?

@glebm
Copy link
Collaborator Author

glebm commented Aug 30, 2023

It will compile natively on the Pi with GCC from ppa:ubuntu-toolchain-r/test, we can add a note about it in the instructions

@glebm
Copy link
Collaborator Author

glebm commented Aug 30, 2023

Ah it's not Ubuntu, so need to find the Debian equivalent of that

@glebm
Copy link
Collaborator Author

glebm commented Aug 31, 2023

nix may be a good option for Debian:

sudo mkdir /nix
sudo chown ${USER}: /nix
sh <(curl -L https://nixos.org/nix/install) --no-daemon
source ~/.nix-profile/etc/profile.d/nix.sh
nix-shell -p gcc

@glebm
Copy link
Collaborator Author

glebm commented Aug 31, 2023

Actually, both Debian 11 and Ubuntu 20.04 have clang-11 that has most of C++20 support. Perhaps we can use that

@glebm glebm force-pushed the cpp20 branch 2 times, most recently from a0254e5 to 3ff188d Compare August 31, 2023 09:12
@glebm glebm force-pushed the cpp20 branch 14 times, most recently from 8f3d085 to 34f1e8d Compare August 31, 2023 13:34
@glebm
Copy link
Collaborator Author

glebm commented Aug 31, 2023

Ubuntu 20.04 is missing the libc++11-dev so I went all the way to clang-18 from https://apt.llvm.org/
It works!

glibc compatibility remains the same.

We now use Clang 18 and static libc++ for the Aarch64 build.
Linux x86 and x86_64 builds now use GCC 13.
@AJenbo
Copy link
Member

AJenbo commented Sep 1, 2023

Looks good. But just to be clear, if we build like this can we distribute the builds to users of 20.04 (arm64/amd64) as we normally do, or do they need to also install some of these externals for it to run?

@glebm
Copy link
Collaborator Author

glebm commented Sep 1, 2023

No need for any externals, this should launch as-is on Ubuntu 20.04 because the new libraries (libc++ / libstdc++) are linked statically.

@glebm glebm merged commit 9701101 into diasurgical:development Sep 1, 2023
18 checks passed
@glebm glebm deleted the cpp20 branch September 1, 2023 21:56
@tsunamistate
Copy link
Collaborator

Another option for aarch64 users is to download flatpak version, since runtime is downloaded separately, and it doesn't affect system libraries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants