eosnetworkfoundation / engineering

A workspace for documentation by Engineering primarily regarding process
MIT License
0 stars 0 forks source link

Upgrade to C++20 #27

Closed wanderingbort closed 1 year ago

wanderingbort commented 1 year ago

[Transferred from legacy agenda on behalf of @greg7mdp and @ScottBailey]

(Should we) consider switching to -std=c++20 for leap and appbase? (@greg7mdp)

It’s 2023, can we have FULL C++20 support? If now isn’t the right time, when is? (@ScottBailey)

wanderingbort commented 1 year ago

[Transferred from legacy agenda on behalf of @ericpassmore ]

Hmm I'm running /lib32/libstdc++.so.6 today. What version should I be targeting for leap build from main?

wanderingbort commented 1 year ago

[Transferred from legacy agenda on behalf of @spoonincode ]

neither gcc nor clang have released FULL c++20 support

ScottBailey commented 1 year ago

Maybe it is more appropriate to talk about the C++20 features we'd like to use, Matt is correct, full support for C++20 doesn't exist yet.

I think this list might be fairly up to date.

I'd like to use std::span and 3 way comparison operator (<=>).

spoonincode commented 1 year ago

With ubuntu 18 being dropped, I def think we should go ahead and move up to 20 (well, maybe until after the release is cut). But with no compiler fully supporting 20, we need to decide on the minimum compiler we'll target. gcc10 seems reasonable as at least there is a ubuntu20 package and it has most of the good stuff.

greg7mdp commented 1 year ago

Yes, it would be great to move to C++20, and indeed most of the good c++20 stuff is in gcc 10.

Newer compilers can be installed if we add the following repository:

sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test

I have been building with g++-12 for a while.

Also, it is very easy to install any clang version with:

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh <version number> all
ScottBailey commented 1 year ago

Yes, it would be great to move to C++20, and indeed most of the good c++20 stuff is in gcc 10.

Newer compilers can be installed if we add the following repository:

I am a little uncomfortable asking users to install packages outside their basic distro. BUT I'm also interested in using newer tools. Ubuntu 20 is near 3 years old, so I suppose it's a reasonable trade off to ask a user to upgrade either their compiler or OS.

It would be nice to target g++-12 as our "supported" complier.

wanderingbort commented 1 year ago

2.28 meeting notes:

Open Questions:

Decisions to vote on:

greg7mdp commented 1 year ago

So we are now After 4.0. Decision was made to add the -std=c++20 switch. I believe gcc-9 and gcc-10 are available by default on ubuntu20. So I think it would be reasonable to specify gcc-10 as the minimum version supported.

install gcc-10 on ubuntu 20.04.1

apt update -y
apt upgrade -y
apt install -y build-essential
apt install -y gcc-10 g++-10 cpp-10
spoonincode commented 1 year ago

The way I read the 2.28 notes above was that the vote was only to defer this decision until post 4.0 branch. There appears to be outstanding questions still? For example

dependent on "chicken test" ? ❔

greg7mdp commented 1 year ago

Isn't main now post 4.0?

dependent on "chicken test" ?

Apologies, I don't know what that means.

kj4ezj commented 1 year ago

We talked about this briefly on the engineering weekly meeting video call, but the "chickens test" is a colloquialism for a test that takes the entire chain, breaks it down into segments that were collected with a known-good version of code, replays those chain segments with a piece of software under test, verifies that the replayed chain segments link correctly, and then passes or fails based on whether the chain state is equivalent with the software under test and the known-good software. This test is very good at catching consensus deviations where the software under test deviates from the behavior of the known-good software in ways that we do not have unit or integration tests for. People do weird things on-chain.

The colloquialism for the test comes from the :rooster: :rooster: :rooster: emoji in the test name.

wanderingbort commented 1 year ago

Upon further reflection the group is unconvinced that compiler flags would be a material risk for the semantics and therefore chicken testing shouldn't be considered a pre-requisite.

Open Question

greg7mdp commented 1 year ago

We talked about this briefly on the engineering weekly meeting video call, but the "chickens test" is a colloquialism

Thanks Zach, this seems like an excellent test indeed!

greg7mdp commented 1 year ago

the "chickens test" is a colloquialism for a test that takes the entire chain, breaks it down into segments ...

I'm glad it isn't this chicken test.

greg7mdp commented 1 year ago

This Leap Issue was created to track the C++20 upgrade effort. Please direct further comments there. Closing this discussion issue.