[onert] Build fail on g++ 11
Ubuntu 22.04 uses g++ 11.2.0.
Many external libraries fails build by limits standard lib header
/home/nfs/git/ONE/externals/ABSEIL/absl/synchronization/internal/graphcycles.cc: In member function ‘void absl::lts_2020_02_25::synchronization_internal::GraphCycles::RemoveNode(void*)’:
/home/nfs/git/ONE/externals/ABSEIL/absl/synchronization/internal/graphcycles.cc:451:26: error: ‘numeric_limits’ is not a member of ‘std’
451 | if (x->version == std::numeric_limits<uint32_t>::max()) {
To resolve on g++11, we can think two solution
- Update lib version if supported
- Patch external lib source after download
It is not critical issue yet.
ref : https://gcc.gnu.org/gcc-11/porting_to.html
Header dependency changes Some C++ Standard Library headers have been changed to no longer include other headers that were being used internally by the library. As such, C++ programs that used standard library components without including the right headers will no longer compile.
The following headers are used less widely in libstdc++ and may need to be included explicitly when compiled with GCC 11:
(for std::numeric_limits) (for std::unique_ptr, std::shared_ptr etc.) (for std::pair, std::tuple_size, std::index_sequence etc.) (for members of namespace std::this_thread.)
Build fails related to std::runtime_error since gcc-10
ref: https://gcc.gnu.org/gcc-10/porting_to.html
C++ language issues
Header dependency changes
Some C++ Standard Library headers have been changed to no longer include the <stdexcept> header. As such, C++ programs that used components defined in <stdexcept> or <string> without explicitly including the right headers will no longer compile.
Previously components such as std::runtime_error, std::string and std::allocator were implicitly defined after including unrelated headers such as <array> and <optional>. Correct code should include the appropriate headers for the classes being used.
I found out that there is now only one error left in the latest source when building for x86_64 while working on #9503 . Same situation with arm and aarch64. Only ruy throws the error. https://github.com/Samsung/ONE/issues/9503#issuecomment-1197784038
ONE/externals/RUY/ruy/block_map.cc:375:25: error: 'numeric_limits' is not a member of 'std'
375 | int best_score = std::numeric_limits<int>::min();
| ^~~~~~~~~~~~~~
/home/jang/git/ragmani/onert/ONE/externals/RUY/ruy/block_map.cc:375:40: error: expected primary-expression before 'int'
375 | int best_score = std::numeric_limits<int>::min();
| ^~~
This error was fixed by https://github.com/google/ruy/pull/253 in ruy repo.
But ruy::BasicSpec was renamed to ruy::MulParams at https://github.com/google/ruy/pull/11, and this causes errors. So, all modules(cker and ruy in the directory compute) using ruy must be updated to use a high version of ruy than https://github.com/google/ruy/pull/253.
@hseok-oh 's already working this at #9500.
@hseok-oh I checked it works well now. Thanks :+1: