Skip to content

Build Error with Thrift.h:36:21: error: static assertion failed on ubuntu24.04 #425

@elisa523

Description

@elisa523

Describe the bug
Build Error with Thrift.h:36:21: error: static assertion failed on ubuntu24.04

To Reproduce
Steps to reproduce the behavior:

  1. ./contrib/build.sh -d -v -S

Expected behavior
expect build successfully.

Desktop (please complete the following information):

  • OS: ubuntu24.04
  • Browser [e.g. chrome, safari]
  • Version : Release Stable 20240320

Additional context
[ 5%] Built target thrift_generated_files
make -f common/CMakeFiles/cachelib_common.dir/build.make common/CMakeFiles/cachelib_common.dir/depend
make[2]: Entering directory '/home/sv/Documents/CacheLib/build-cachelib'
cd /home/sv/Documents/CacheLib/build-cachelib && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/sv/Documents/CacheLib/cachelib /home/sv/Documents/CacheLib/cachelib/common /home/sv/Documents/CacheLib/build-cachelib /home/sv/Documents/CacheLib/build-cachelib/common /home/sv/Documents/CacheLib/build-cachelib/common/CMakeFiles/cachelib_common.dir/DependInfo.cmake "--color="
Dependencies file "common/CMakeFiles/cachelib_common.dir/BloomFilter.cpp.o.d" is newer than depends file "/home/sv/Documents/CacheLib/build-cachelib/common/CMakeFiles/cachelib_common.dir/compiler_depend.internal".
Consolidate compiler generated dependencies of target cachelib_common
make[2]: Leaving directory '/home/sv/Documents/CacheLib/build-cachelib'
make -f common/CMakeFiles/cachelib_common.dir/build.make common/CMakeFiles/cachelib_common.dir/build
make[2]: Entering directory '/home/sv/Documents/CacheLib/build-cachelib'
[ 6%] Building CXX object common/CMakeFiles/cachelib_common.dir/BloomFilter.cpp.o
cd /home/sv/Documents/CacheLib/build-cachelib/common && /usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFMT_SHARED -DGFLAGS_IS_A_DLL=0 -I/home/sv/Documents/CacheLib/cachelib/.. -I/home/sv/Documents/CacheLib/build-cachelib/.. -I/home/sv/Documents/CacheLib/build-cachelib -isystem /home/sv/Documents/CacheLib/opt/cachelib/include -isystem /usr/include/libdwarf -isystem /usr/include/libiberty -g -std=gnu++17 -fPIC -fsized-deallocation -MD -MT common/CMakeFiles/cachelib_common.dir/BloomFilter.cpp.o -MF CMakeFiles/cachelib_common.dir/BloomFilter.cpp.o.d -o CMakeFiles/cachelib_common.dir/BloomFilter.cpp.o -c /home/sv/Documents/CacheLib/cachelib/common/BloomFilter.cpp
In file included from /home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Serializer.h:24,
from /home/sv/Documents/CacheLib/cachelib/../cachelib/common/Serialization.h:27,
from /home/sv/Documents/CacheLib/cachelib/../cachelib/common/BloomFilter.h:24,
from /home/sv/Documents/CacheLib/cachelib/common/BloomFilter.cpp:17:
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:36:21: error: static assertion failed: Thrift must be built with C++20 or later.
36 | FOLLY_CPLUSPLUS >= 202002L, "Thrift must be built with C++20 or later.");
| ^
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:36:21: note: the comparison reduces to ‘(201703 >= 202002)’
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:227:53: error: ‘requires’ was not declared in this scope
227 | static constexpr bool is_deprecated_terse_field = requires {
| ^~~~~~~~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h: In static member function ‘static constexpr bool apache::thrift::detail::st::struct_private_access::__fbthrift_has_struct_annotation()’:
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:147:19: error: ‘requires’ was not declared in this scope
147 | if constexpr (requires { typename T::__fbthrift_struct_annotations; }) {
| ^~~~~~~~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:147:28: error: expected ‘)’ before ‘{’ token
147 | if constexpr (requires { typename T::__fbthrift_struct_annotations; }) {
| ^
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:147:18: note: to match this ‘(’
147 | if constexpr (requires { typename T::__fbthrift_struct_annotations; }) {
| ^
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h: In static member function ‘static constexpr bool apache::thrift::detail::st::struct_private_access::__fbthrift_has_field_annotation()’:
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:155:19: error: ‘requires’ was not declared in this scope
155 | if constexpr (requires {
| ^~~~~~~~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:155:28: error: expected ‘)’ before ‘{’ token
155 | if constexpr (requires {
| ^
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:155:18: note: to match this ‘(’
155 | if constexpr (requires {
| ^
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h: In static member function ‘static constexpr const int16_t* apache::thrift::detail::st::struct_private_access::field_ids_in_serialization_order()’:
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:203:19: error: ‘requires’ was not declared in this scope
203 | if constexpr (requires {
| ^~~~~~~~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:203:28: error: expected ‘)’ before ‘{’ token
203 | if constexpr (requires {
| ^
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:203:18: note: to match this ‘(’
203 | if constexpr (requires {
| ^
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h: At global scope:
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:309:1: error: ‘concept’ does not name a type; did you mean ‘const’?
309 | concept ThriftClass = is_thrift_class_v;
| ^~~~~~~
| const
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:309:1: note: ‘concept’ only available with ‘-std=c++20’ or ‘-fconcepts’
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:326:1: error: ‘concept’ does not name a type; did you mean ‘const’?
326 | concept ThriftEnum = is_thrift_enum_v;
| ^~~~~~~
| const
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/Thrift.h:326:1: note: ‘concept’ only available with ‘-std=c++20’ or ‘-fconcepts’
In file included from /home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/BinaryProtocol.h:26,
from /home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Serializer.h:25:
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Protocol.h: In function ‘constexpr bool apache::thrift::usesFieldNames()’:
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Protocol.h:446:17: error: ‘requires’ was not declared in this scope
446 | if constexpr (requires { typename Protocol::ProtocolReader; }) {
| ^~~~~~~~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Protocol.h:446:25: error: expected ‘)’ before ‘{’ token
446 | if constexpr (requires { typename Protocol::ProtocolReader; }) {
| ~ ^~
| )
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Protocol.h:448:33: error: expected ‘)’ before ‘{’ token
448 | } else if constexpr (!requires { Protocol::kUsesFieldNames(); }) {
| ~ ^~
| )
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Protocol.h: In instantiation of ‘constexpr bool apache::thrift::usesFieldNames() [with Protocol = BinaryProtocolReader]’:
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/BinaryProtocol.h:377:52: required from here
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Protocol.h:447:12: error: no type named ‘ProtocolReader’ in ‘class apache::thrift::BinaryProtocolReader’
447 | return usesFieldNames();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/BinaryProtocol.h: At global scope:
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/BinaryProtocol.h:377:15: error: non-constant condition for static assertion
377 | static_assert(!usesFieldNames());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/BinaryProtocol.h:377:52: error: ‘constexpr bool apache::thrift::usesFieldNames() [with Protocol = BinaryProtocolReader]’ called in a constant expression
377 | static_assert(!usesFieldNames());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Protocol.h:445:16: note: ‘constexpr bool apache::thrift::usesFieldNames() [with Protocol = BinaryProtocolReader]’ is not usable as a ‘constexpr’ function because:
445 | constexpr bool usesFieldNames() {
| ^~~~~~~~~~~~~~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Protocol.h: In instantiation of ‘constexpr bool apache::thrift::usesFieldNames() [with Protocol = BinaryProtocolWriter]’:
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/BinaryProtocol.h:378:52: required from here
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Protocol.h:451:37: error: ‘kUsesFieldNames’ is not a member of ‘apache::thrift::BinaryProtocolWriter’
451 | return Protocol::kUsesFieldNames();
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/BinaryProtocol.h:378:15: error: non-constant condition for static assertion
378 | static_assert(!usesFieldNames());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/BinaryProtocol.h:378:52: error: ‘constexpr bool apache::thrift::usesFieldNames() [with Protocol = BinaryProtocolWriter]’ called in a constant expression
378 | static_assert(!usesFieldNames());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Protocol.h:445:16: note: ‘constexpr bool apache::thrift::usesFieldNames() [with Protocol = BinaryProtocolWriter]’ is not usable as a ‘constexpr’ function because:
445 | constexpr bool usesFieldNames() {
| ^~~~~~~~~~~~~~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Protocol.h: In instantiation of ‘constexpr bool apache::thrift::usesFieldNames() [with Protocol = CompactProtocolReader]’:
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/CompactProtocol.h:446:53: required from here
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Protocol.h:447:12: error: no type named ‘ProtocolReader’ in ‘class apache::thrift::CompactProtocolReader’
447 | return usesFieldNames();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/Serializer.h:26:
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/CompactProtocol.h:446:15: error: non-constant condition for static assertion
446 | static_assert(!usesFieldNames());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sv/Documents/CacheLib/opt/cachelib/include/thrift/lib/cpp2/protocol/CompactProtocol.h:446:53: error: ‘constexpr bool apache::thrift::usesFieldNames() [with Protocol = CompactProtocolReader]’ called in a constant expression
446 | static_assert(!usesFieldNames());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions