install flatbuffers

  78%] Building CXX object CMakeFiles/flattests.dir/tests/test.cpp.o
In file included from /root/snort_src/flatbuffers-1.12.0/tests/test.cpp:39:
/root/snort_src/flatbuffers-1.12.0/tests/arrays_test_generated.h: In constructor ‘MyGame::Example::ArrayStruct::ArrayStruct(float, int8_t, int32_t)’:
/root/snort_src/flatbuffers-1.12.0/tests/arrays_test_generated.h:156:34: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct MyGame::Example::NestedStruct’; use assignment or value-initialization instead [-Werror=class-memaccess]
  156 |     std::memset(d_, 0, sizeof(d_));
      |                                  ^
/root/snort_src/flatbuffers-1.12.0/tests/arrays_test_generated.h:66:40: note: ‘struct MyGame::Example::NestedStruct’ declared here
   66 | FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) NestedStruct FLATBUFFERS_FINAL_CLASS {
      |                                        ^~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/flattests.dir/build.make:160:CMakeFiles/flattests.dir/tests/test.cpp.o] 错误 1
make[2]: 离开目录“/root/snort_src/flatbuffers-build”
make[1]: *** [CMakeFiles/Makefile2:282:CMakeFiles/flattests.dir/all] 错误 2
make[1]: 离开目录“/root/snort_src/flatbuffers-build”
make: *** [Makefile:163:all] 错误 2

 

我选用了gcc-7 安装 flatbuffers1.11.0解决了,但是并不清楚原因;

这个错误是源于snort 官方文档:在Ubuntu Linux 18-20 上配置Snort环境的 2021年2月版文档,希望能帮到受到同样错误烦恼的人,同时也希望有人能够给出这个错误的原因。