google / flatbuffers

FlatBuffers: Memory Efficient Serialization Library

Home Page:https://flatbuffers.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flatbuffer 1.11.0 failed with errors

ywang-nr opened this issue · comments

Environment Versions:

  1. cmake 3.22.2
  2. make 3.81
  3. clang 13.0.0

Problem:

  1. Script
    git clone https://github.com/google/flatbuffers.git
    cd flatbuffers
    git checkout 1.11.0
    cmake -G "Unix Makefiles"
    make --> failed here with error messages at multiple places as below

mobile_flatbuffer_schemas/flatbuffers/include/flatbuffers/flatbuffers.h:1720:25: error: definition of implicit copy constructor for 'TableKeyComparatorreflection::Object' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
TableKeyComparator &operator=(const TableKeyComparator &);

Does anyone have any insight of how to fix this? Thanks.

Looks like an issue with the copy constructor for that comparator.

Is there a reason to work on version 1.11.0? You are getting the latest code and building it, you should almost always be running from top of master.

Update: The Fix

  • checkout flatbuffer 1.11.0
  • open CMakeLists.txt
  • remove -Werror inside this line of code
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Wno-unused-parameter")
  • it will compile fine now once turned off "treat warnings as errors"
  • Question is: why is the case?

Thanks for your feedback.

We're not ready to upgrade to the latest yet, my coworkers can build on their machine but not mine and another coworker, but we can build with the latest 2.0.0. So wondering a specific environment probably is out of the version support for 1.11.0, do you have any insights towards what could it be other the ones I listed below?

cmake 3.22.2
make 3.81
clang 13.0.0
JAVA openjdk version "1.8.0_292"

We treat all warnings as errors as we want to produce the most correct version of flatbuffers we can. Any warnings we get from the compiler should be examined in our opinion.

Going back to the reason you are seeing it. We delete the copy assignment operator of the TableKeyComparator that looks like you are using with Reflection::Object.

Hi @dbaileychess

We are building with v1.10.0 and we also face the same issue (the reason to use the older version is also the same for us, we are not yet ready to upgrade - as we are using an older version in our releases).

One question we have is - when we checkout v1.10.0 - we assumed that those warnings to be treated as errors should not happen (as at that version, I assume you would not have either had that condition to treat warnings as error - or would not have not deleted the copy assignment). But why is it failing in v1.10.0 itself?

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

This issue was automatically closed due to no activity for 6 months plus the 14 day notice period.