facebookincubator/fizz

build error since 06.28 release

Closed this issue · 12 comments

/usr/include/folly/Traits.h:544:8: error: ‘value’ is not a member of ‘std::is_base_of<std::exception, x509_st>’ 544 | struct Conjunction<T, TList...>

I've been getting this build error with every fizz release since 2021.06.28.00. Am I missing an unspecified dependency or something? I assume that the developer isn;t getting this error since new releases have continued since 6/28.

I have been using, and continue to use, the latest releases of folly. Currently on 2021.07.20.00.

Cannot repro on Ubuntu 20.04. What is your environment? (distribution, compiler, etc.)

Sorry. Should've included that info.

Distribution - arch linux
Compiler version - gcc-11.1.0

Also, this error precedes the one I posted - they're related, obviously, and part of the same build error:

/usr/include/c++/11.1.0/type_traits:1372:38: error: invalid use of incomplete type ‘struct x509_st’ 1372 | : public integral_constant<bool, __is_base_of(_Base, _Derived)>

Am doing a test build with gcc-10. I'll update this post when I know whether or not that fixes it.

I cannot repro with a clean archlinux chroot.

Built successfully with https://gist.github.com/mingtaoy/f1d666e3b01cfe9d44d1c8ab1a2689b3

/usr/include/folly/

Is this folly from the AUR? This is not supported by us.

Yes. folly from the AUR. it is the github release - the only difference is that the AUR version uses a PKGBUILD file to initate the build:

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -S . -B _build
cmake --build _build

What is supported then? folly-git is also available...

my gcc10 test builds are taking me down a rabbit hole. my posted fizz error went away, but it wouldn't link against the gcc11-built folly. tried to rebuild folly with gcc10, but it chokes trying to link against fmt-8.0.1... not sure i feel like rebuilding fmt with gcc10.

what version of the compiler are you using?

i'm getting the same error with gcc10, that always comes back to /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include/c++/type_traits:1412:38 (or the gcc11 type_traits, depending on compiler version).

error: invalid use of incomplete type ‘struct x509_st’ 1412 | : public integral_constant<bool, __is_base_of(_Base, _Derived)>

i don;t believe for a second that folly is the problem, AUR version or not. folly's Traits.h ultimately leads back to the compiler's type_traits header file no matter what build of folly you're using. fizz uses this folly header file. folly builds. fizz does not. so there's a difference, obviously, in how the code bases of folly and fizz treat/use Traits.h. any ideas?

@mingtaoy

Built successfully with https://gist.github.com/mingtaoy/f1d666e3b01cfe9d44d1c8ab1a2689b3

You need to enable building tests (BUILD_TESTS=ON) to reproduce the mentioned build error.

Click to expand build log
[ 28%] Built target FizzCommandCommonTest
Consolidate compiler generated dependencies of target FizzServerTest
[ 28%] Building CXX object CMakeFiles/FizzServerTest.dir/server/test/FizzServerTest.cpp.o
In file included from /usr/include/c++/11.1.0/bits/move.h:57,
                 from /usr/include/c++/11.1.0/bits/stl_pair.h:59,
                 from /usr/include/c++/11.1.0/utility:70,
                 from /usr/include/c++/11.1.0/algorithm:60,
                 from /usr/include/gmock/gmock-actions.h:137,
                 from /usr/include/gmock/gmock.h:59,
                 from /home/anno/dev/fb/install/include/folly/portability/GMock.h:32,
                 from /home/anno/dev/fb/fizz/fizz/server/test/FizzServerTest.cpp:9:
/usr/include/c++/11.1.0/type_traits: In instantiation of ‘struct std::is_base_of<std::exception, x509_st>’:
/home/anno/dev/fb/install/include/folly/Traits.h:544:8:   required from ‘struct folly::Conjunction<std::is_base_of<std::exception, x509_st>, folly::exception_wrapper::IsRegularExceptionType<x509_st> >’
/home/anno/dev/fb/install/include/folly/ExceptionWrapper.h:375:7:   required by substitution of ‘template<class Ex, class Ex_, typename std::enable_if<static_cast<bool>(folly::Conjunction<std::is_base_of<std::exception, typename std::decay<_Tp2>::type>, folly::exception_wrapper::IsRegularExceptionType<Ex_> >::value), long int>::type <anonymous> > folly::exception_wrapper::exception_wrapper(Ex&&) [with Ex = const x509_st&; Ex_ = x509_st; typename std::enable_if<static_cast<bool>(folly::Conjunction<std::is_base_of<std::exception, typename std::decay<_Tp2>::type>, folly::exception_wrapper::IsRegularExceptionType<Ex_> >::value), long int>::type <anonymous> = <missing>]’
/usr/include/gtest/gtest-printers.h:211:33:   required by substitution of ‘template<class T, class, class> static void testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter::PrintValue(const T&, std::ostream*) [with T = x509_st; <template-parameter-1-2> = void; <template-parameter-1-3> = <missing>]’
/usr/include/gtest/gtest-printers.h:291:36:   required by substitution of ‘template<class T, class Printer, class ... Printers> struct testing::internal::FindFirstPrinter<T, decltype (Printer::PrintValue(declval<const T&>(), nullptr)), Printer, Printers ...> [with T = x509_st; Printer = testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter; Printers = {testing::internal::ProtobufPrinter, testing::internal::ConvertibleToIntegerPrinter, testing::internal::ConvertibleToStringViewPrinter, testing::internal::RawBytesPrinter, testing::internal::FallbackPrinter}]’
/usr/include/gtest/gtest-printers.h:287:8:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/gtest/gtest-printers.h:307:9:   required from ‘void testing::internal::PrintWithFallback(const T&, std::ostream*) [with T = x509_st; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:441:30:   required from ‘void testing::internal::PrintTo(const T&, std::ostream*) [with T = x509_st; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:691:12:   required from ‘static void testing::internal::UniversalPrinter<T>::Print(const T&, std::ostream*) [with T = x509_st; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:617:31:   required from ‘void testing::internal::PrintSmartPointer(const Ptr&, std::ostream*, int) [with T = x509_st; Ptr = std::unique_ptr<x509_st, folly::static_function_deleter<x509_st, X509_free> >; <template-parameter-1-3> = void; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:624:25:   required from ‘void testing::internal::PrintTo(const std::unique_ptr<_Tp, _Dp>&, std::ostream*) [with T = x509_st; D = folly::static_function_deleter<x509_st, X509_free>; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:691:12:   required from ‘static void testing::internal::UniversalPrinter<T>::Print(const T&, std::ostream*) [with T = std::unique_ptr<x509_st, folly::static_function_deleter<x509_st, X509_free> >; std::ostream = std::basic_ostream<char>]’
/usr/include/gmock/gmock-spec-builders.h:1388:31:   required from ‘void testing::internal::ActionResultHolder<T>::PrintAsActionResult(std::ostream*) const [with T = std::unique_ptr<x509_st, folly::static_function_deleter<x509_st, X509_free> >; std::ostream = std::basic_ostream<char>]’
/usr/include/gmock/gmock-spec-builders.h:1385:8:   required from here
/usr/include/c++/11.1.0/type_traits:1372:38: error: invalid use of incomplete type ‘struct x509_st’
 1372 |     : public integral_constant<bool, __is_base_of(_Base, _Derived)>
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/evp.h:14,
                 from /home/anno/dev/fb/fizz/fizz/crypto/aead/AESGCM128.h:11,
                 from /home/anno/dev/fb/fizz/fizz/protocol/Factory.h:12,
                 from /home/anno/dev/fb/fizz/fizz/protocol/FizzBase.h:11,
                 from /home/anno/dev/fb/fizz/fizz/server/FizzServer.h:11,
                 from /home/anno/dev/fb/fizz/fizz/server/test/FizzServerTest.cpp:12:
/usr/include/openssl/ossl_typ.h:121:16: note: forward declaration of ‘struct x509_st’
  121 | typedef struct x509_st X509;
      |                ^~~~~~~
In file included from /home/anno/dev/fb/install/include/folly/Optional.h:68,
                 from /home/anno/dev/fb/fizz/fizz/crypto/aead/Aead.h:11,
                 from /home/anno/dev/fb/fizz/fizz/crypto/aead/OpenSSLEVPCipher.h:12,
                 from /home/anno/dev/fb/fizz/fizz/protocol/Factory.h:16,
                 from /home/anno/dev/fb/fizz/fizz/protocol/FizzBase.h:11,
                 from /home/anno/dev/fb/fizz/fizz/server/FizzServer.h:11,
                 from /home/anno/dev/fb/fizz/fizz/server/test/FizzServerTest.cpp:12:
/home/anno/dev/fb/install/include/folly/Traits.h: In instantiation of ‘struct folly::Conjunction<std::is_base_of<std::exception, x509_st>, folly::exception_wrapper::IsRegularExceptionType<x509_st> >’:
/home/anno/dev/fb/install/include/folly/ExceptionWrapper.h:375:7:   required by substitution of ‘template<class Ex, class Ex_, typename std::enable_if<static_cast<bool>(folly::Conjunction<std::is_base_of<std::exception, typename std::decay<_Tp2>::type>, folly::exception_wrapper::IsRegularExceptionType<Ex_> >::value), long int>::type <anonymous> > folly::exception_wrapper::exception_wrapper(Ex&&) [with Ex = const x509_st&; Ex_ = x509_st; typename std::enable_if<static_cast<bool>(folly::Conjunction<std::is_base_of<std::exception, typename std::decay<_Tp2>::type>, folly::exception_wrapper::IsRegularExceptionType<Ex_> >::value), long int>::type <anonymous> = <missing>]’
/usr/include/gtest/gtest-printers.h:211:33:   required by substitution of ‘template<class T, class, class> static void testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter::PrintValue(const T&, std::ostream*) [with T = x509_st; <template-parameter-1-2> = void; <template-parameter-1-3> = <missing>]’
/usr/include/gtest/gtest-printers.h:291:36:   required by substitution of ‘template<class T, class Printer, class ... Printers> struct testing::internal::FindFirstPrinter<T, decltype (Printer::PrintValue(declval<const T&>(), nullptr)), Printer, Printers ...> [with T = x509_st; Printer = testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter; Printers = {testing::internal::ProtobufPrinter, testing::internal::ConvertibleToIntegerPrinter, testing::internal::ConvertibleToStringViewPrinter, testing::internal::RawBytesPrinter, testing::internal::FallbackPrinter}]’
/usr/include/gtest/gtest-printers.h:287:8:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/gtest/gtest-printers.h:307:9:   required from ‘void testing::internal::PrintWithFallback(const T&, std::ostream*) [with T = x509_st; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:441:30:   required from ‘void testing::internal::PrintTo(const T&, std::ostream*) [with T = x509_st; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:691:12:   required from ‘static void testing::internal::UniversalPrinter<T>::Print(const T&, std::ostream*) [with T = x509_st; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:617:31:   required from ‘void testing::internal::PrintSmartPointer(const Ptr&, std::ostream*, int) [with T = x509_st; Ptr = std::unique_ptr<x509_st, folly::static_function_deleter<x509_st, X509_free> >; <template-parameter-1-3> = void; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:624:25:   required from ‘void testing::internal::PrintTo(const std::unique_ptr<_Tp, _Dp>&, std::ostream*) [with T = x509_st; D = folly::static_function_deleter<x509_st, X509_free>; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:691:12:   required from ‘static void testing::internal::UniversalPrinter<T>::Print(const T&, std::ostream*) [with T = std::unique_ptr<x509_st, folly::static_function_deleter<x509_st, X509_free> >; std::ostream = std::basic_ostream<char>]’
/usr/include/gmock/gmock-spec-builders.h:1388:31:   required from ‘void testing::internal::ActionResultHolder<T>::PrintAsActionResult(std::ostream*) const [with T = std::unique_ptr<x509_st, folly::static_function_deleter<x509_st, X509_free> >; std::ostream = std::basic_ostream<char>]’
/usr/include/gmock/gmock-spec-builders.h:1385:8:   required from here
/home/anno/dev/fb/install/include/folly/Traits.h:544:8: error: ‘value’ is not a member of ‘std::is_base_of<std::exception, x509_st>’
  544 | struct Conjunction<T, TList...>
      |        ^~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: note: unrecognized command-line option ‘-Wno-inconsistent-missing-override’ may have been intended to silence earlier diagnostics
make[2]: *** [CMakeFiles/FizzServerTest.dir/build.make:76: CMakeFiles/FizzServerTest.dir/server/test/FizzServerTest.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:274: CMakeFiles/FizzServerTest.dir/all] Error 2
make: *** [Makefile:166: all] Error 2


x509_st (X509) is an opaque type in OpenSSL 1.1.1, but it somehow ends up being used directly in a std::is_base_of check.

@MrAnno

Thanks much. No build errors with BUILD_TESTS=OFF. Hopefully this will lead to a fix.

This is likely due to the mismatch in googletest/gmock versions that we use internally (1.10.0) and the one supplied by arch (1.11.0). Specifically, google/googletest@6b2e749 is probably the reason. We use std::unique_ptr<X509, X509_deleter> as an RAII version of X509*, and the newer gtest attempts to dereference the contents behind the pointer.

Surprisingly, clang compiles this successfully. Possibly a difference in SFINAE/template instantiation behavior between clang and gcc?

using clang/clang++ does indeed build successfully.