p4c
p4c copied to clipboard
[TESTING] Switch compilation from C++17 to C++20
Based on #4347. This applies a workaround that makes boost < 1.74 compatible with GCC >= 10 in the C++20 mode.
Wow, very gross hack! :)
Yes. And a bit obscure too as it requires non-standard g++ but standard boost version on Ubuntu 20.04 (sure, there will be more platforms with this problem, but they are not officially supported). I still think we should make sure we can compile with GCC 10 on 20.04 though. BTW. clang can't handle the compilation at all on Ubuntu 20.04 unless GCC 10 is installed -- there is some compatibility problem with abseil which tries to use <compare>.
I'll need to double-check some parts though... the problem is it also modifies type of the string inside, which is no longer std::string, but a different instance of std::basic_string<...>. Which is why I had to change one of the helper functions' signatures. I'll double check we are not doing some string copies because of this and if so probably make this conditional to the case it is actually needed.
Clever solution. Nevertheless, it might be easier to just compile with a version of boost that is not broken?
It is not broken, it is just old. At the time of its release, the method might have been deprecated, but that is all...
This issue seemed stuck to me... It all depends on what we want for Ubuntu 20.04.
- Say we only support GCC 9, no clang.
- We have to move sanitizers to 22.04 or newer.
- If we want to bump GCC minimal version requirement for P4C we will require custom boost install on Ubuntu 20.04.
- Support GCC 10+ on Ubuntu 20.04 with the old boost they have.
- Get rid of the boost from platform dependency... I believe this path is stuck currently.
It looks like boost doesn't really support backporting patches, otherwise we could tried to fix up older versions of boost.
Get rid of the boost from platform dependency... I believe this path is stuck currently.
I can push #4663 forward, the current issue is the massive amount of includes added by this loop.
I thought we already required a certain minimum version of boost? Newer than what is installed by default on some versions of Ubuntu. We should probably just bump that up to 1.74
I thought we already required a certain minimum version of boost?
Not that I know of. We always just required that the boost version of the oldest Ubuntu version works.
It is possible the Tofino compiler had a requirement: https://github.com/p4lang/p4c/blob/fd4ae763609ac3773cc8af6e6e096ed9f05b5217/backends/tofino/CMakeLists.txt#L53