proton icon indicating copy to clipboard operation
proton copied to clipboard

build: "cannot assign to non-static data member" caused by obsolete version of "flatbuffer"

Open XiaochenCui opened this issue 1 year ago • 0 comments

Describe what's wrong

Got error when build from scratch, using llvm-20.

How to reproduce

create file CMakePresets.json:

{
  "version": 3,
  "cmakeMinimumRequired": {
    "major": 3,
    "minor": 21,
    "patch": 0
  },
  "configurePresets": [
    {
      "name": "llvm17",
      "generator": "Ninja",
      "cacheVariables": {
        "CMAKE_C_COMPILER": "/usr/lib/llvm-17/bin/clang",
        "CMAKE_CXX_COMPILER": "/usr/lib/llvm-17/bin/clang++"
      }
    },
    {
      "name": "llvm20",
      "generator": "Ninja",
      "cacheVariables": {
        "CMAKE_C_COMPILER": "/usr/lib/llvm-20/bin/clang",
        "CMAKE_CXX_COMPILER": "/usr/lib/llvm-20/bin/clang++"
      }
    }
  ]
}
# build using llvm-20
cmake . -B build --preset llvm20
ninja -C build

Error message and/or stacktrace

[build] /home/xiaochen/code/proton/contrib/flatbuffers/include/flatbuffers/stl_emulation.h:549:12: error: cannot assign to non-static data member 'count_' with const-qualified type 'const size_type' (aka 'const unsigned long')
[build]   549 |     count_ = other.count_;
[build]       |     ~~~~~~ ^
[build] /home/xiaochen/code/proton/contrib/flatbuffers/include/flatbuffers/stl_emulation.h:628:19: note: non-static data member 'count_' declared const here
[build]   628 |   const size_type count_;
[build]       |   ~~~~~~~~~~~~~~~~^~~~~~
[build] 1 error generated.

Additional context

This issue was also reported at: https://github.com/CleverRaven/Cataclysm-DDA/issues/77355 and is fixed at: https://github.com/google/flatbuffers/commit/20aad0c41e1252b04c72111c3eb221280a9c2009

I'm going to update its version to new and do some verification to ensure the correctness and performance.

XiaochenCui avatar Jan 08 '25 02:01 XiaochenCui