google / flatbuffers

FlatBuffers: Memory Efficient Serialization Library

Home Page:https://flatbuffers.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'strtoull_l' was not declared in this scope [C++, gcc 10.3, Alpine 3.14, flatbuffers 2.0.6]

Eisenheim9 opened this issue · comments

I am using vcpkg and since its latest update of flatbuffers to 2.0.6 I have the following errors on Alpine:

#include <flatbuffers/flatbuffers.h>
int main() {}
flatbuffers/util.h: In function 'void flatbuffers::strtoval_impl(int64_t*, const char*, char**, int)':
flatbuffers/util.h:227:38: error: 'strtoll_l' was not declared in this scope; did you mean 'strcoll_l'?
  227 |     #define __strtoll_impl(s, pe, b) strtoll_l(s, pe, b, ClassicLocale::Get())
      |                                      ^~~~~~~~~
flatbuffers/util.h:245:12: note: in expansion of macro '__strtoll_impl'
  245 |     *val = __strtoll_impl(str, endptr, base);
      |            ^~~~~~~~~~~~~~
flatbuffers/util.h: In function 'void flatbuffers::strtoval_impl(uint64_t*, const char*, char**, int)':
flatbuffers/util.h:226:39: error: 'strtoull_l' was not declared in this scope; did you mean 'strcoll_l'?
  226 |     #define __strtoull_impl(s, pe, b) strtoull_l(s, pe, b, ClassicLocale::Get())
      |                                       ^~~~~~~~~~
flatbuffers/util.h:250:10: note: in expansion of macro '__strtoull_impl'
  250 |   *val = __strtoull_impl(str, endptr, base);
      |          ^~~~~~~~~~~~~~~

With flatbuffers 2.0.0 it builds fine, but the error appeared since commit 6c8c291.

A quick fix was to remove #include "flatbuffers/util.h" from flatbuffers/verifier.h and add #include "flatbuffers/util.h" in src/bfbs_gen_lua.cpp, and it compiles without any error.

Thanks, sometimes these refactors are hard to evaluate when cannot test every environment.

@Eisenheim9 Can you let me know that my change in #7266 fixes the issue for you.

Yes it fixes the issue, thank you!

This issue is happening in (at least) flatbuffers 23.3.3 in latest Alpine:

  • flatbuffers: 23.3.3
  • OS: Alpine Linux 3.18
  • make version: GNU Make 4.4.1
  • gcc/g++ version: 12.2.1
flatbuffers-23.3.3/include/flatbuffers/util.h:229:38: error: 'strtoll_l' was not declared in this scope; did you mean 'strtold_l'?
  229 |     #define __strtoll_impl(s, pe, b) strtoll_l(s, pe, b, ClassicLocale::Get())

More info here: versatica/mediasoup#1223 (comment)

I'm seeing that the flatbuffers check for strtoull_l returns negative in Alpine:

Screenshot 2023-11-22 at 11 32 39

cc @dbaileychess