Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

‘VerifyNestedFlexBuffer’ is not a member of ‘flexbuffers’ [C++, gcc 11.2.0, Arch Linux, Flatbuffers v2.0.6] #7134

Closed
technobaboo opened this issue Feb 27, 2022 · 13 comments · Fixed by #7207

Comments

@technobaboo
Copy link

As it says in the title, after using flatc to rebuild the flatbuffer schemas that include flexbuffers (https://github.com/StardustXR/libstardustxr/blob/main/src/common/flatbuffers/message.fbs#L9) the error below occurs:

In file included from ../src/fusion/types/data/../../../common/messenger.hpp:9,
                 from ../src/fusion/types/data/../../messenger.hpp:3,
                 from ../src/fusion/types/data/../../fusion_internal.hpp:3,
                 from ../src/fusion/types/data/receiver.cpp:5:
../src/fusion/types/data/../../../common/flatbuffers/message.hpp: In member function ‘bool StardustXR::Message::Verify(flatbuffers::Verifier&) const’:
../src/fusion/types/data/../../../common/flatbuffers/message.hpp:76:25: error: ‘VerifyNestedFlexBuffer’ is not a member of ‘flexbuffers’
   76 |            flexbuffers::VerifyNestedFlexBuffer(data(), verifier) &&
      |

This issue never happened in 2.0.5.

@dbaileychess
Copy link
Collaborator

Looks like you need to include flatbuffers.h, see comment:

#ifdef FLATBUFFERS_H_
// This is a verifier utility function that works together with the
// FlatBuffers verifier, which should only be present if flatbuffer.h
// has been included (which it typically is in generated code).
inline bool VerifyNestedFlexBuffer(const flatbuffers::Vector<uint8_t> *nv,
flatbuffers::Verifier &verifier) {
if (!nv) return true;
return verifier.Check(flexbuffers::VerifyBuffer(
nv->data(), nv->size(), verifier.GetFlexReuseTracker()));
}
#endif

@technobaboo
Copy link
Author

That's the weird part, this is inside the c++ file that flatc generated by using the command

flatc -c *.fbs --gen-mutable --filename-suffix "" --filename-ext "hpp"

(see https://github.com/StardustXR/libstardustxr/blob/main/src/common/flatbuffers/message.hpp#L4-L8)

It includes the file, but still errors. Weirder still, this only ever occurs on v2.0.6 and not when reverting the flatbuffers version back to 2.0.5

@dbaileychess
Copy link
Collaborator

If you remove the #ifdef FLATBUFFERS_H_ part does it work? I don't see anything obvious on why it isn't being linked in.

@aardappel
Copy link
Collaborator

Looks like flexbuffers.h somehow got included manually before the generated code. Can you scan where you include flexbuffers.h and see what happens if you remove/move it to below the generated code include?

@technobaboo
Copy link
Author

technobaboo commented Mar 2, 2022 via email

@technobaboo
Copy link
Author

technobaboo commented Mar 2, 2022 via email

@dbaileychess
Copy link
Collaborator

Yeah, let's leave this open for now, I'll need to look into how to do this correctly.

@aardappel
Copy link
Collaborator

The problem is we ideally want to keep these headers independent.

One solution may be to just add a copy of that function to the generated code.

@technobaboo
Copy link
Author

technobaboo commented Mar 2, 2022 via email

@dbaileychess
Copy link
Collaborator

@technobaboo can you try out the linked PR to see if it works for you?

@MalekiRe
Copy link

I am having this issue.

@dbaileychess
Copy link
Collaborator

This is merged now, so do you have the latest code?

@technobaboo
Copy link
Author

technobaboo commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants