Closed andresovela closed 4 months ago
You would have to use the supported bazel version. Could you please try building using bazelisk, as that would download the supported bazel version? As in bazelisk build //:xcore-opt
.
Using bazelisk I now do not have that problem, but the build still fails with the following error:
ERROR: /home/andy/.cache/bazel/_bazel_andy/8b429239a50f407a9e6918483356d160/external/lib_tflmc/BUILD.bazel:175:11: Compiling lib_tflite_micro/src/tflite-xcore-kernels/xcore_utils.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/micro/flatbuffer_utils.h:19,
from external/lib_tflite_micro/lib_tflite_micro/submodules/tflite-micro/tensorflow/lite/micro/micro_allocator.h:23,
from external/lib_tflite_micro/lib_tflite_micro/submodules/tflite-micro/tensorflow/lite/micro/micro_resource_variable.h:22,
from external/lib_tflite_micro/lib_tflite_micro/submodules/tflite-micro/tensorflow/lite/micro/micro_graph.h:21,
from external/lib_tflite_micro/lib_tflite_micro/submodules/tflite-micro/tensorflow/lite/micro/micro_context.h:20,
from external/lib_tflite_micro/lib_tflite_micro/submodules/tflite-micro/tensorflow/lite/micro/kernels/kernel_util.h:26,
from external/lib_tflite_micro/lib_tflite_micro/src/tflite-xcore-kernels/xcore_utils.h:9,
from external/lib_tflite_micro/lib_tflite_micro/src/tflite-xcore-kernels/xcore_utils.cc:1:
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
I'm not sure what's going wrong. A patch has to be applied to lib_tflite_micro repo, which maybe has not been done. Could you please try these steps, https://github.com/xmos/ai_tools/blob/develop/docs/rst/build-from-source.rst ?
I hadn't done that, but now I did and I get the same error.
I was able to compile xformer by manually removing const
from the count_
variable the compiler is complaining about. No idea what's the right way to fix this.
ERROR: /home/andy/.cache/bazel/_bazel_andy/8b429239a50f407a9e6918483356d160/external/lib_tflmc/BUILD.bazel:175:11: Compiling lib_tflite_micro/src/tflite-xcore-kernels/xcore_utils.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)
Hmmm, I wonder if "-std=c++0x" is an issue. You could try a full clean and rebuild with the instructions from the build-from-source.rst . Another option is to look through https://github.com/xmos/ai_tools/blob/develop/.github/workflows/build-and-test.yml in case you notice something that is different.
I did run bazel clean --expunge
to do a full clean (not sure what that does, just saw it on StackOverflow) and tried to build again, but I got the same error.
Nothing in particular caught my eye in the build-and-test.yml
file.
I did test what I had to test already by manually patching the bad file, so I don't really need to solve this anymore. I'm not sure if you wanna keep the issue open for tracking or if we should close it considering that it apparently only affects me.
No worries, I'll close this issue for now.
I'm not familiar with Bazel, but running
bazel build //:xcore-opt
as suggested in the README fails with the following error:It seems the problem is that for some reason the build system is looking for
lib_tflmc.BUILD
underai_tools/xformer/external
instead of justai_tools/xformer
.Note: I'm trying to build using Bazel 7.2.0, I updated
.bazelversion
to reflect my installed version.