xmos / lib_tflite_micro

10 stars 11 forks source link

Update flatbuffers submodule #169

Open andresovela opened 1 month ago

andresovela commented 1 month ago

I keep getting build errors when I build xformer (see https://github.com/xmos/ai_tools/issues/909).

ERROR: /home/andy/.cache/bazel/_bazel_andy/8b429239a50f407a9e6918483356d160/external/lib_tflmc/BUILD.bazel:175:11: Compiling tensorflow/lite/micro/arena_allocator/single_arena_buffer_allocator.cc failed: (Exit 1): gcc failed: error executing command (from target @lib_tflmc//:tflmc_lib) /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 118 arguments skipped)
In file included from external/lib_tflite_micro/lib_tflite_micro/submodules/flatbuffers/include/flatbuffers/array.h:21,
                 from external/lib_tflite_micro/lib_tflite_micro/submodules/flatbuffers/include/flatbuffers/flatbuffers.h:22,
                 from external/lib_tflite_micro/lib_tflite_micro/submodules/tflite-micro/tensorflow/lite/schema/schema_generated.h:7,
                 from external/lib_tflite_micro/lib_tflite_micro/submodules/tflite-micro/tensorflow/lite/micro/memory_helpers.h:22,
                 from external/tflite_micro/tensorflow/lite/micro/arena_allocator/single_arena_buffer_allocator.cc:26:
external/lib_tflite_micro/lib_tflite_micro/submodules/flatbuffers/include/flatbuffers/stl_emulation.h: In member function 'constexpr flatbuffers::span<T, Extent>& flatbuffers::span<T, Extent>::operator=(const flatbuffers::span<T, Extent>&)':
external/lib_tflite_micro/lib_tflite_micro/submodules/flatbuffers/include/flatbuffers/stl_emulation.h:386:12: error: assignment of read-only member 'flatbuffers::span<T, Extent>::count_'
  386 |     count_ = other.count_;
      |     ~~~~~~~^~~~~~~~~~~~~~
Target //:xcore-opt failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 9.925s, Critical Path: 3.75s
INFO: 29 processes: 18 internal, 11 local.
FAILED: Build did NOT complete successfully

The fix is to go to this line and remove the const qualifier. https://github.com/google/flatbuffers/blob/615616cb5549a34bdf288c04bc1b94bd7a65c396/include/flatbuffers/stl_emulation.h#L465

This variable is no longer declared const on master: https://github.com/google/flatbuffers/blob/fb9afbafc7dfe226b9db54d4923bfb8839635274/include/flatbuffers/stl_emulation.h#L470

andresovela commented 1 month ago

See https://github.com/google/flatbuffers/issues/7226