facebook/fbthrift

Can't compile fbthrift with clang: thrift/lib/cpp/ContextStack.cpp:229:5: error: no matching function for call to 'operator delete'

donsbot opened this issue · 1 comments

Experimenting with compiling with clang (various versions, including 11,12,13), fails at:

/usr/bin/c++ -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_CONTEXT_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_REGEX_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK -DFMT_LOCALE -DFMT_SHARED -DGFLAGS_IS_A_DLL=0 -DTHRIFT_HAVE_LIBSNAPPY=0 -Dasync_EXPORTS -I/tmp/fbcode_builder_getdeps-ZrootZGleanZhsthriftZbuildZfbcode_builder-root/repos/github.com-facebook-fbthrift.git -I/tmp/fbcode_builder_getdeps-ZrootZGleanZhsthriftZbuildZfbcode_builder-root/build/fbthrift -isystem /usr/include/libiberty -isystem /root/.hsthrift/include -O2 -g -DNDEBUG -fPIC -std=c++17 -MD -MT thrift/lib/cpp/CMakeFiles/async.dir/ContextStack.cpp.o -MF thrift/lib/cpp/CMakeFiles/async.dir/ContextStack.cpp.o.d -o thrift/lib/cpp/CMakeFiles/async.dir/ContextStack.cpp.o -c /tmp/fbcode_builder_getdeps-ZrootZGleanZhsthriftZbuildZfbcode_builder-root/repos/github.com-facebook-fbthrift.git/thrift/lib/cpp/ContextStack.cpp
/tmp/fbcode_builder_getdeps-ZrootZGleanZhsthriftZbuildZfbcode_builder-root/repos/github.com-facebook-fbthrift.git/thrift/lib/cpp/ContextStack.cpp:229:5: error: no matching function for call to 'operator delete'
    operator delete (
    ^~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/new:155:6: note: candidate function not viable: no known conversion from 'const std::size_t' (aka 'const unsigned long') to 'std::align_val_t' for 2nd argument
void operator delete(void*, std::align_val_t, const std::nothrow_t&)
     ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/new:180:13: note: candidate function not viable: requires 2 arguments, but 3 were provided
inline void operator delete  (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
            ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/new:153:6: note: candidate function not viable: requires 2 arguments, but 3 were provided
void operator delete(void*, std::align_val_t)
     ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/new:144:6: note: candidate function not viable: requires 2 arguments, but 3 were provided
void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
     ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/new:130:6: note: candidate function not viable: requires 1 argument, but 3 were provided
void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
     ^
1 error generated.

Work around is to pass -fsized-deallocation, which is sufficient to compile fbthrift with clang. E.g. "CMAKE_CXX_FLAGS": "-fsized-deallocation" to cmake.

Not sure if we want to fix this or patch upstream?

0115eaa
seems should be resolved after this