Enabling c++20 on linux
Description
Enabling c++20 on Linux Currently blocking issue:
- Eigen using deprecated '[=]' lambda expression.
Motivation and Context
We want the latest and the greatest features from c++20.
depends on
- [x] https://github.com/microsoft/onnxruntime/pull/21071
- [x] https://github.com/microsoft/onnxruntime/pull/21127
- [x] https://github.com/microsoft/onnxruntime/pull/21482
- [ ] Update NDK version in use-android-ndk.yml to 27
We cannot do it for Linux CUDA build yet. Because the compiler we use is GCC 8, which is too low.
Just out of curiosity. Why do you need C++20? Would it crash onnxruntime build in my old conda environment?
For your second question, no. A new C++ standard consists of two things:
- Core language features like constexpr/constinit, which do not need runtime support.
- New std header files and functions like
, which do not need a new runtime library.
The first one doesn't have impact on compatibility. The second one has impacts on non-Windows/non-Linux systems like macOS/iOS. We can avoid the issue by not using the headers that are not supported by the target system.
Wait this #20786 . The PR will update all GCCs to >=11. Now we still have GCC 8.
The GCC version is updated.
Just out of curiosity. Why do you need C++20? Would it crash onnxruntime build in my old conda environment?
We can use the new C++ features to write better code, and it shouldn't impact our compatibility at runtime. The language features are listed in https://gcc.gnu.org/projects/cxx-status.html in "C++20 Language Features" section
depends on #21071
This is also dependent on #21127
How is it going?
Now we are using NDK 27?