error: there are no arguments to ‘occupiedMask’ that depend on a template parameter, so a declaration of ‘occupiedMask’ must be available
folly fails to build on riscv64 when compiled as part of dawrfs 0.12.1:
/usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DDWARFS_HAVE_CLOSE_RANGE=1 -DFMT_SHARED -DFOLLY_CFG_NO_COROUTINES -DGLOG_NO_ABBREVIATED_SEVERITIES -DGLOG_USE_GLOG_EXPORT -DNOGDI -DNOMINMAX -D_GNU_SOURCE -D_REENTRANT -I/home/abuild/rpmbuild/BUILD/dwarfs-0.12.1-build/dwarfs-0.12.1/include -isystem /home/abuild/rpmbuild/BUILD/dwarfs-0.12.1-build/dwarfs-0.12.1/build/folly -isystem /home/abuild/rpmbuild/BUILD/dwarfs-0.12.1-build/dwarfs-0.12.1/folly -isystem /home/abuild/rpmbuild/BUILD/dwarfs-0.12.1-build/dwarfs-0.12.1/fast_float -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -O2 -g -DNDEBUG -std=c++20 -fPIC -fdiagnostics-color=always -g -finput-charset=UTF-8 -fsigned-char -Wall -Wno-deprecated -Wno-deprecated-declarations -Wno-sign-compare -Wno-unused -Wuninitialized -Wunused-label -Wunused-result -Wextra -pedantic -Wno-stringop-overflow -MD -MT CMakeFiles/dwarfs_folly_lite.dir/folly/folly/container/detail/F14Table.cpp.o -MF CMakeFiles/dwarfs_folly_lite.dir/folly/folly/container/detail/F14Table.cpp.o.d -o CMakeFiles/dwarfs_folly_lite.dir/folly/folly/container/detail/F14Table.cpp.o -c /home/abuild/rpmbuild/BUILD/dwarfs-0.12.1-build/dwarfs-0.12.1/folly/folly/container/detail/F14Table.cpp In file included from /home/abuild/rpmbuild/BUILD/dwarfs-0.12.1-build/dwarfs-0.12.1/folly/folly/container/detail/F14Table.cpp:17: /home/abuild/rpmbuild/BUILD/dwarfs-0.12.1-build/dwarfs-0.12.1/folly/folly/container/detail/F14Table.h: In member function ‘folly::f14::detail::DenseMaskIter folly::f14::detail::F14Chunk<ItemType>::occupiedIter() const’: /home/abuild/rpmbuild/BUILD/dwarfs-0.12.1-build/dwarfs-0.12.1/folly/folly/container/detail/F14Table.h:792:37: error: there are no arguments to ‘occupiedMask’ that depend on a template parameter, so a declaration of ‘occupiedMask’ must be available [-fpermissive] 792 | return DenseMaskIter{&tags_[0], occupiedMask()}; | ^~~~~~~~~~~~
Manually defining FOLLY_HAVE_INT128_T doesn't work either:
/home/abuild/rpmbuild/BUILD/dwarfs-0.12.1-build/dwarfs-0.12.1/fbthrift/thrift/lib/cpp2/gen/module_types_cpp.cpp:34:78: error: static assertion failed: oversized
34 | !FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE || !folly::has_extended_alignment ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
35 | sizeof(enum_find
A workaround is to define FOLLY_F14_FORCE_FALLBACK=1.
An obvious problem is that the CMake check for FOLLY_HAVE_INT128_T is missing completely, thus it's never defined in the generated folly-config.h.
The code to set FOLLY_F14_VECTOR_INTRINSICS_AVAILABLE surprisingly has a check for FOLLY_RISCV64, presumably because it would use __uint128_t there.
I'm unsure about why exactly the static_assert in fbthrift is unhappy when FOLLY_HAVE_INT128_T is set manually.
In any case, DwarFS has dropped all direct references to F14Table with the 0.12.3 release and it only remains as a dependency for fbthrift. I'm reasonably sure the workaround suggested above won't cause any regressions.
Hi @andreas-schwab and @mhx,
Thank you for the suggestion to use -DFOLLY_F14_FORCE_FALLBACK=1.
I can confirm that adding this flag successfully resolved the initial occupiedMask compilation error. However, this revealed a secondary issue during the build: the compilation now fails when building the test suite.
The new error occurs in folly/container/test/F14SetTest.cpp and appears to be a static_assert failure within the C++ standard library's <hashtable_policy.h>. It seems one of the heterogeneous lookup tests is incompatible with the underlying std::unordered_set used in the fallback implementation.
The key error messages are:
/usr/include/c++/13/bits/hashtable_policy.h:1317:25: error: static assertion failed: hash function must be invocable with an argument of key type
...
/usr/include/c++/13/bits/hashtable_policy.h:1725:13: error: static assertion failed: key equality predicate must be invocable with two arguments of key type
Following this, I tried building again with tests disabled by adding -DBUILD_TESTS=OFF to the CMake flags. With both flags set (-DFOLLY_F14_FORCE_FALLBACK=1 and -DBUILD_TESTS=OFF), the build completed successfully.
This confirms the Folly library itself is buildable on riscv64 with the fallback flag, and the remaining issue is isolated to the test suite. This combination of flags provides a complete workaround for now.
Build Environment:
- Architecture: riscv64
- OS: Ubuntu 24.04
- Compiler: GNU 13.3.0