diff options
author | Chunseok Lee <chunseok.lee@samsung.com> | 2024-06-10 15:01:36 +0900 |
---|---|---|
committer | Chunseok Lee <chunseok.lee@samsung.com> | 2024-06-10 15:09:38 +0900 |
commit | 9d8027e1a93c4cf3e717cc0c3db1f55dd1db58d5 (patch) | |
tree | 0c880bd8bb531fc9699cd528f4670f86a83bdf19 | |
parent | a48d0b5e5a59268370739c6f40a0ac0872d3f8fc (diff) | |
download | nnfw-9d8027e1a93c4cf3e717cc0c3db1f55dd1db58d5.tar.gz nnfw-9d8027e1a93c4cf3e717cc0c3db1f55dd1db58d5.tar.bz2 nnfw-9d8027e1a93c4cf3e717cc0c3db1f55dd1db58d5.zip |
Fix gcc14 build error on FLATBUFFER
Signed-off-by: Chunseok Lee <chunseok.lee@samsung.com>
-rw-r--r-- | packaging/nnfw.spec | 5 | ||||
-rw-r--r-- | packaging/remove_const.patch | 37 |
2 files changed, 42 insertions, 0 deletions
diff --git a/packaging/nnfw.spec b/packaging/nnfw.spec index 522d7779a..3d1289552 100644 --- a/packaging/nnfw.spec +++ b/packaging/nnfw.spec @@ -30,6 +30,7 @@ Source3017: VULKAN.tar.gz Source3018: XNNPACK.tar.gz Source3019: FLATBUFFERS-2.0.tar.gz Source3020: NEON2SSE.tar.gz +Source3021: remove_const.patch %{!?build_type: %define build_type Release} %{!?npud_build: %define npud_build 1} @@ -214,6 +215,10 @@ tar -xf %{SOURCE3017} -C ./externals tar -xf %{SOURCE3018} -C ./externals tar -xf %{SOURCE3019} -C ./externals tar -xf %{SOURCE3020} -C ./externals +cp -xf %{SOURCE3021} ./externals +cd externals/FLATBUFFERS-2.0 +pwd +patch -p1 < ../remove_const.patch %build %ifarch arm armv7l armv7hl aarch64 x86_64 %ix86 riscv64 diff --git a/packaging/remove_const.patch b/packaging/remove_const.patch new file mode 100644 index 000000000..93b43dd26 --- /dev/null +++ b/packaging/remove_const.patch @@ -0,0 +1,37 @@ +--- a/include/flatbuffers/stl_emulation.h ++++ b/include/flatbuffers/stl_emulation.h +@@ -45,14 +45,18 @@ + #endif + #endif // defined(FLATBUFFERS_USE_STD_OPTIONAL) ... + +-// The __cpp_lib_span is the predefined feature macro. +-#if defined(FLATBUFFERS_USE_STD_SPAN) +- #include <span> +-#elif defined(__cpp_lib_span) && defined(__has_include) +- #if __has_include(<span>) +- #include <span> +- #define FLATBUFFERS_USE_STD_SPAN ++#ifndef FLATBUFFERS_USE_STD_SPAN ++ // Testing __cpp_lib_span requires including either <version> or <span>, ++ // both of which were added in C++20. ++ // See: https://en.cppreference.com/w/cpp/utility/feature_test ++ #if defined(__cplusplus) && __cplusplus >= 202002L ++ #define FLATBUFFERS_USE_STD_SPAN 1 + #endif ++#endif // FLATBUFFERS_USE_STD_SPAN ++ ++#if defined(FLATBUFFERS_USE_STD_SPAN) ++ #include <array> ++ #include <span> + #else + // Disable non-trivial ctors if FLATBUFFERS_SPAN_MINIMAL defined. + #if !defined(FLATBUFFERS_TEMPLATES_ALIASES) || defined(FLATBUFFERS_CPP98_STL) +@@ -625,7 +629,7 @@ + private: + // This is a naive implementation with 'count_' member even if (Extent != dynamic_extent). + pointer const data_; +- const size_type count_; ++ size_type count_; + }; + + #if !defined(FLATBUFFERS_SPAN_MINIMAL) |