facebook / CacheLib

Pluggable in-process caching engine to build and scale high performance services
https://www.cachelib.org
Apache License 2.0
1.18k stars 254 forks source link

Fail to build dependency fbthrift (with errors reported in fmt) #289

Closed siyuanchai1999 closed 1 month ago

siyuanchai1999 commented 6 months ago

Hi CacheLib Team, I try to build to Cachelib on ubuntu 22.04 (g++ version 11.4). It reports dependency building error for fbthrift. with errors in fmt/format.h. Is this a fmt version problem? I don't know if I can do a change of fmt version for a quick fix.

here's what I did to compile:

git clone https://github.com/facebook/CacheLib
cd CacheLib
./contrib/build.sh -j -T
[ 12%] Building CXX object thrift/compiler/CMakeFiles/compiler_base.dir/sema/standard_validator.cc.o
In file included from /home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/parse/parse_ast.cc:26:
/home/yans3/CacheLib/opt/cachelib/include/fmt/format.h:2369:1: error: partial specialization of ‘struct fmt::v8::formatter<std::__cxx11::basic_string<_CharT>, Char>’ after instantiation of ‘struct fmt::v8::formatter<std::__cxx11::basic_string<char>, char, void>’ [-fpermissive]
 2369 | FMT_FORMAT_AS(std::basic_string<Char>, basic_string_view<Char>);
      | ^~~~~~~~~~~~~
/home/yans3/CacheLib/opt/cachelib/include/fmt/format.h:2371:1: error: partial specialization of ‘struct fmt::v8::formatter<std::basic_string_view<Char>, Char>’ after instantiation of ‘struct fmt::v8::formatter<std::basic_string_view<char>, char, void>’ [-fpermissive]
 2371 | FMT_FORMAT_AS(detail::std_string_view<Char>, basic_string_view<Char>);
      | ^~~~~~~~~~~~~
In file included from /home/yans3/CacheLib/cachelib/external/fbthrift/./thrift/compiler/lib/cpp2/util.h:40,
                 from /home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/sema/patch_mutator.cc:26:
/home/yans3/CacheLib/opt/cachelib/include/fmt/format.h:2369:1: error: partial specialization of ‘struct fmt::v8::formatter<std::__cxx11::basic_string<_CharT>, Char>’ after instantiation of ‘struct fmt::v8::formatter<std::__cxx11::basic_string<char>, char, void>’ [-fpermissive]
 2369 | FMT_FORMAT_AS(std::basic_string<Char>, basic_string_view<Char>);
      | ^~~~~~~~~~~~~
/home/yans3/CacheLib/opt/cachelib/include/fmt/format.h:2371:1: error: partial specialization of ‘struct fmt::v8::formatter<std::basic_string_view<Char>, Char>’ after instantiation of ‘struct fmt::v8::formatter<std::basic_string_view<char>, char, void>’ [-fpermissive]
 2371 | FMT_FORMAT_AS(detail::std_string_view<Char>, basic_string_view<Char>);
      | ^~~~~~~~~~~~~
In file included from /home/yans3/CacheLib/cachelib/external/fbthrift/./thrift/compiler/lib/cpp2/util.h:40,
                 from /home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/sema/standard_mutator.cc:22:
/home/yans3/CacheLib/opt/cachelib/include/fmt/format.h:2369:1: error: partial specialization of ‘struct fmt::v8::formatter<std::__cxx11::basic_string<_CharT>, Char>’ after instantiation of ‘struct fmt::v8::formatter<std::__cxx11::basic_string<char>, char, void>’ [-fpermissive]
 2369 | FMT_FORMAT_AS(std::basic_string<Char>, basic_string_view<Char>);
      | ^~~~~~~~~~~~~
/home/yans3/CacheLib/opt/cachelib/include/fmt/format.h:2371:1: error: partial specialization of ‘struct fmt::v8::formatter<std::basic_string_view<Char>, Char>’ after instantiation of ‘struct fmt::v8::formatter<std::basic_string_view<char>, char, void>’ [-fpermissive]
 2371 | FMT_FORMAT_AS(detail::std_string_view<Char>, basic_string_view<Char>);
      | ^~~~~~~~~~~~~
In file included from /home/yans3/CacheLib/cachelib/external/fbthrift/./thrift/compiler/lib/cpp2/util.h:40,
                 from /home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/lib/cpp2/util.cc:17:
/home/yans3/CacheLib/opt/cachelib/include/fmt/format.h:2369:1: error: partial specialization of ‘struct fmt::v8::formatter<std::__cxx11::basic_string<_CharT>, Char>’ after instantiation of ‘struct fmt::v8::formatter<std::__cxx11::basic_string<char>, char, void>’ [-fpermissive]
 2369 | FMT_FORMAT_AS(std::basic_string<Char>, basic_string_view<Char>);
      | ^~~~~~~~~~~~~
/home/yans3/CacheLib/opt/cachelib/include/fmt/format.h:2371:1: error: partial specialization of ‘struct fmt::v8::formatter<std::basic_string_view<Char>, Char>’ after instantiation of ‘struct fmt::v8::formatter<std::basic_string_view<char>, char, void>’ [-fpermissive]
 2371 | FMT_FORMAT_AS(detail::std_string_view<Char>, basic_string_view<Char>);
      | ^~~~~~~~~~~~~
In file included from /home/yans3/CacheLib/opt/cachelib/include/fmt/ranges.h:18,
                 from /home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/sema/standard_validator.cc:25:
/home/yans3/CacheLib/opt/cachelib/include/fmt/format.h:2369:1: error: partial specialization of ‘struct fmt::v8::formatter<std::__cxx11::basic_string<_CharT>, Char>’ after instantiation of ‘struct fmt::v8::formatter<std::__cxx11::basic_string<char>, char, void>’ [-fpermissive]
 2369 | FMT_FORMAT_AS(std::basic_string<Char>, basic_string_view<Char>);
      | ^~~~~~~~~~~~~
/home/yans3/CacheLib/opt/cachelib/include/fmt/format.h:2371:1: error: partial specialization of ‘struct fmt::v8::formatter<std::basic_string_view<Char>, Char>’ after instantiation of ‘struct fmt::v8::formatter<std::basic_string_view<char>, char, void>’ [-fpermissive]
 2371 | FMT_FORMAT_AS(detail::std_string_view<Char>, basic_string_view<Char>);
      | ^~~~~~~~~~~~~
/home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/lib/cpp2/util.cc: In function ‘std::string apache::thrift::compiler::cpp2::sha256_hex(const string&)’:
/home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/lib/cpp2/util.cc:611:14: warning: ‘int SHA256_Init(SHA256_CTX*)’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  611 |   SHA256_Init(&hasher);
      |   ~~~~~~~~~~~^~~~~~~~~
In file included from /home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/lib/cpp2/util.cc:25:
/usr/include/openssl/sha.h:73:27: note: declared here
   73 | OSSL_DEPRECATEDIN_3_0 int SHA256_Init(SHA256_CTX *c);
      |                           ^~~~~~~~~~~
/home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/lib/cpp2/util.cc:612:16: warning: ‘int SHA256_Update(SHA256_CTX*, const void*, size_t)’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  612 |   SHA256_Update(&hasher, in.data(), in.size());
      |   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/lib/cpp2/util.cc:25:
/usr/include/openssl/sha.h:74:27: note: declared here
   74 | OSSL_DEPRECATEDIN_3_0 int SHA256_Update(SHA256_CTX *c,
      |                           ^~~~~~~~~~~~~
/home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/lib/cpp2/util.cc:613:15: warning: ‘int SHA256_Final(unsigned char*, SHA256_CTX*)’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  613 |   SHA256_Final(mid, &hasher);
      |   ~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from /home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/lib/cpp2/util.cc:25:
/usr/include/openssl/sha.h:76:27: note: declared here
   76 | OSSL_DEPRECATEDIN_3_0 int SHA256_Final(unsigned char *md, SHA256_CTX *c);
      |                           ^~~~~~~~~~~~
In file included from /home/yans3/CacheLib/cachelib/external/fbthrift/./thrift/compiler/ast/t_program.h:27,
                 from /home/yans3/CacheLib/cachelib/external/fbthrift/./thrift/compiler/ast/ast_visitor.h:36,
                 from /home/yans3/CacheLib/cachelib/external/fbthrift/./thrift/compiler/sema/ast_validator.h:19,
                 from /home/yans3/CacheLib/cachelib/external/fbthrift/./thrift/compiler/sema/standard_validator.h:19,
                 from /home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/sema/standard_validator.cc:17:
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h: In instantiation of ‘constexpr decltype (ctx.begin()) fmt::v8::detail::parse_format_specs(ParseContext&) [with T = std::__cxx11::basic_string<char> [5]; ParseContext = fmt::v8::detail::compile_parse_context<char, fmt::v8::detail::error_handler>; decltype (ctx.begin()) = const char*]’:
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h:2688:9:   required from ‘constexpr fmt::v8::detail::format_string_checker<Char, ErrorHandler, Args>::format_string_checker(fmt::v8::basic_string_view<Char>, ErrorHandler) [with Char = char; ErrorHandler = fmt::v8::detail::error_handler; Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [5]}]’
/home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/sema/standard_validator.cc:743:14:   required from here
/home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/sema/standard_validator.cc:743:14:   in ‘constexpr’ expansion of ‘fmt::v8::basic_format_string<char, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (&)[5]>("Bad priority \'{}\'. Choose one of {}.")’
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h:2442:12: error: use of deleted function ‘fmt::v8::detail::fallback_formatter<T, Char, Enable>::fallback_formatter() [with T = std::__cxx11::basic_string<char> [5]; Char = char; Enable = void]’
 2442 |   auto f = conditional_t<has_formatter<mapped_type, context>::value,
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2443 |                          formatter<mapped_type, char_type>,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2444 |                          fallback_formatter<T, char_type>>();
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h:963:3: note: declared here
  963 |   fallback_formatter() = delete;
      |   ^~~~~~~~~~~~~~~~~~
make[2]: *** [thrift/compiler/CMakeFiles/compiler.dir/build.make:132: thrift/compiler/CMakeFiles/compiler.dir/lib/cpp2/util.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:333: thrift/compiler/CMakeFiles/compiler.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: *** [thrift/compiler/CMakeFiles/compiler_base.dir/build.make:216: thrift/compiler/CMakeFiles/compiler_base.dir/sema/patch_mutator.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [thrift/compiler/CMakeFiles/compiler_base.dir/build.make:244: thrift/compiler/CMakeFiles/compiler_base.dir/sema/standard_mutator.cc.o] Error 1
make[2]: *** [thrift/compiler/CMakeFiles/compiler_base.dir/build.make:160: thrift/compiler/CMakeFiles/compiler_base.dir/parse/parse_ast.cc.o] Error 1
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h: In instantiation of ‘static void fmt::v8::detail::value<Context>::format_custom_arg(const void*, typename Context::parse_context_type&, Context&) [with T = std::__cxx11::basic_string<char> [5]; Formatter = fmt::v8::detail::fallback_formatter<std::__cxx11::basic_string<char> [5], char, void>; Context = fmt::v8::basic_format_context<fmt::v8::appender, char>; typename Context::parse_context_type = fmt::v8::basic_format_parse_context<char>]’:
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h:1172:19:   required from ‘constexpr fmt::v8::detail::value<Context>::value(const T&) [with T = std::__cxx11::basic_string<char> [5]; Context = fmt::v8::basic_format_context<fmt::v8::appender, char>]’
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h:1571:14:   required from ‘constexpr fmt::v8::detail::value<Context> fmt::v8::detail::make_arg(const T&) [with bool IS_PACKED = true; Context = fmt::v8::basic_format_context<fmt::v8::appender, char>; fmt::v8::detail::type <anonymous> = fmt::v8::detail::type::custom_type; T = std::__cxx11::basic_string<char> [5]; typename std::enable_if<IS_PACKED, int>::type <anonymous> = 0]’
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h:1694:64:   required from ‘constexpr fmt::v8::format_arg_store<Context, Args>::format_arg_store(const Args& ...) [with Context = fmt::v8::basic_format_context<fmt::v8::appender, char>; Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [5]}]’
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h:1710:18:   required from ‘constexpr fmt::v8::format_arg_store<Context, Args ...> fmt::v8::make_format_args(const Args& ...) [with Context = fmt::v8::basic_format_context<fmt::v8::appender, char>; Args = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [5]}]’
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h:2886:44:   required from ‘std::string fmt::v8::format(fmt::v8::format_string<T ...>, T&& ...) [with T = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (&)[5]}; std::string = std::__cxx11::basic_string<char>; fmt::v8::format_string<T ...> = fmt::v8::basic_format_string<char, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (&)[5]>]’
/home/yans3/CacheLib/cachelib/external/fbthrift/./thrift/compiler/diagnostic.h:204:46:   required from ‘void apache::thrift::compiler::diagnostics_engine::report(apache::thrift::compiler::diagnostic_location, apache::thrift::compiler::diagnostic_level, fmt::v8::format_string<T ...>, T&& ...) [with T = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (&)[5]}; fmt::v8::format_string<T ...> = fmt::v8::basic_format_string<char, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (&)[5]>]’
/home/yans3/CacheLib/cachelib/external/fbthrift/./thrift/compiler/diagnostic.h:238:11:   required from ‘void apache::thrift::compiler::diagnostics_engine::error(apache::thrift::compiler::diagnostic_location, fmt::v8::format_string<T ...>, T&& ...) [with T = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (&)[5]}; fmt::v8::format_string<T ...> = fmt::v8::basic_format_string<char, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (&)[5]>]’
/home/yans3/CacheLib/cachelib/external/fbthrift/./thrift/compiler/diagnostic.h:249:12:   required from ‘bool apache::thrift::compiler::diagnostics_engine::check(bool, apache::thrift::compiler::diagnostic_location, fmt::v8::format_string<T ...>, T&& ...) [with T = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (&)[5]}; fmt::v8::format_string<T ...> = fmt::v8::basic_format_string<char, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (&)[5]>]’
/home/yans3/CacheLib/cachelib/external/fbthrift/./thrift/compiler/ast/diagnostic_context.h:123:17:   required from ‘bool apache::thrift::compiler::diagnostic_context::check(bool, fmt::v8::format_string<T ...>, T&& ...) [with T = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (&)[5]}; fmt::v8::format_string<T ...> = fmt::v8::basic_format_string<char, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (&)[5]>]’
/home/yans3/CacheLib/cachelib/external/fbthrift/thrift/compiler/sema/standard_validator.cc:743:14:   required from here
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h:1184:15: error: use of deleted function ‘fmt::v8::detail::fallback_formatter<T, Char, Enable>::fallback_formatter() [with T = std::__cxx11::basic_string<char> [5]; Char = char; Enable = void]’
 1184 |     Formatter f;
      |               ^
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h:963:3: note: declared here
  963 |   fallback_formatter() = delete;
      |   ^~~~~~~~~~~~~~~~~~
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h:1185:28: error: ‘struct fmt::v8::detail::fallback_formatter<std::__cxx11::basic_string<char> [5], char, void>’ has no member named ‘parse’
 1185 |     parse_ctx.advance_to(f.parse(parse_ctx));
      |                          ~~^~~~~
/home/yans3/CacheLib/opt/cachelib/include/fmt/core.h:1186:22: error: ‘struct fmt::v8::detail::fallback_formatter<std::__cxx11::basic_string<char> [5], char, void>’ has no member named ‘format’
 1186 |     ctx.advance_to(f.format(*static_cast<const T*>(arg), ctx));
      |                    ~~^~~~~~
make[2]: *** [thrift/compiler/CMakeFiles/compiler_base.dir/build.make:258: thrift/compiler/CMakeFiles/compiler_base.dir/sema/standard_validator.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:307: thrift/compiler/CMakeFiles/compiler_base.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
build-package.sh: error: make failed
build.sh: error: failed to build dependency 'fbthrift'

Here's output of update-submodules.sh

yans3@spr3:~/CacheLib$ ./contrib/update-submodules.sh
Submodule path 'cachelib/external/fbthrift': checked out 'eca43d4980a147304be41de85ae1e4f24e128fc3'
Submodule path 'cachelib/external/fizz': checked out '6182dd9102947ec15dcc56fabd9094294b2aeb21'
Submodule path 'cachelib/external/folly': checked out '323e467e2375e535e10bda62faf2569e8f5c9b19'
Submodule path 'cachelib/external/mvfst': checked out '77ba7e7b54d72a551f5b17f109ba53e8ebc46257'
Submodule path 'cachelib/external/wangle': checked out '4bbb245dd8e80a88348e19cfaf499cc8e607536d'
Entering 'cachelib/external/fbthrift'
Entering 'cachelib/external/fizz'
Entering 'cachelib/external/folly'
Entering 'cachelib/external/mvfst'
Entering 'cachelib/external/wangle'
Previous HEAD position was 4bbb245d Updating submodules
HEAD is now at 3fbb5387 Updating submodules
Previous HEAD position was 6182dd91 Updating submodules
HEAD is now at e5e3147f Updating submodules

Here's what happened with /contrib/build-package.sh fmt

yans3@spr3:~/CacheLib$ ./contrib/build-package.sh fmt
Fetching origin
HEAD is now at d141cdbe Update version
-- CMake version: 3.22.1
-- Module support is disabled.
-- Version: 8.0.1
-- Build type: RelWithDebInfo
-- CXX_STANDARD: 11
-- Required features: cxx_variadic_templates
-- Target 'doc' disabled (requires doxygen)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yans3/CacheLib/build-fmt
Consolidate compiler generated dependencies of target fmt
[100%] Built target fmt
'fmt' is now installed
xiaguan commented 5 months ago

I got same question on my ubuntu 22.04. It seems the build CI was failed few days ago.

jaesoo-fb commented 5 months ago

Hi @siyuanchai1999 @xiaguan

Could you try with the tag v20240312_RC instead?

Unfortunately, there are many moving parts that could break the CacheLib build. So, I suggest to use the latest successful build

siyuanchai1999 commented 5 months ago

Hi, thank you for response. I find v2023.12.11.00 works on my end.

xiaguan commented 5 months ago

I use docker to create a new pure ubuntu22.04 works for me.

therealgymmy commented 1 month ago

thrift issues should be resolved now