From: Chunseok Lee Date: Mon, 10 Jun 2024 06:01:36 +0000 (+0900) Subject: Fix gcc14 build error on FLATBUFFER X-Git-Tag: accepted/tizen/unified/toolchain/20240610.172731~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9d8027e1a93c4cf3e717cc0c3db1f55dd1db58d5;p=platform%2Fcore%2Fml%2Fnnfw.git Fix gcc14 build error on FLATBUFFER Signed-off-by: Chunseok Lee --- diff --git a/packaging/nnfw.spec b/packaging/nnfw.spec index 522d777..3d12895 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 0000000..93b43dd --- /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 +-#elif defined(__cpp_lib_span) && defined(__has_include) +- #if __has_include() +- #include +- #define FLATBUFFERS_USE_STD_SPAN ++#ifndef FLATBUFFERS_USE_STD_SPAN ++ // Testing __cpp_lib_span requires including either or , ++ // 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 ++ #include + #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)