folly icon indicating copy to clipboard operation
folly copied to clipboard

compile error :folly/folly/test/base64_test.cpp

Open yxbu1996 opened this issue 3 years ago • 13 comments

folly/folly/test/base64_test.cpp:73:3: error: non-constant condition for static assertion static_assert(toEncode == decoded);

centos7 linux 4.18 gcc7.3.1

yxbu1996 avatar Jul 20 '22 02:07 yxbu1996

Could you try again with https://github.com/facebook/folly/commit/437b29dd062a40c741b2147827025a2f413b76c7 ? I suspect it may still have issues building the test on some older versions of libstdc++ due to certain things in the standard library not being marked as constexpr.

Does this give any further error about why it considers one of these to be non-constant?

Orvid avatar Jul 22 '22 19:07 Orvid

Seeing similar. https://gist.github.com/donsbot/40bf2089f1b98dcc7b49c913f2e85826#file-gistfile1-txt-L366

Base64SpecialCasesTest.cpp:52:10: error: no viable overloaded '='
    data = {dataBuf.begin(), o};

 note: initializer of 'staticTestCases' is not a constant expression
    if (!testRunner(TestCase{test})) {

Debian 11, clang 11. Similar with gcc-9,10.

Can build if I checkout c4672f5fd4c8ca9da8e2ecf4fda38e4eae82d544

donsbot avatar Jul 25 '22 02:07 donsbot

This is preventing the glean ci from building with either clang or gcc.

https://github.com/facebookincubator/Glean/runs/7550851666?check_suite_focus=true#step:14:832

/tmp/fbcode_builder_getdeps-Z__wZGleanZGleanZhsthriftZbuildZfbcode_builder-root/repos/github.com-facebook-folly.git/folly/detail/base64_detail/tests/Base64PlatformTest.cpp:63:7: note: non-constexpr function 'fill' cannot be used in a constant expression
  res.fill(0);
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/array:117:7: note: declared here
      fill(const value_type& __u)
      ^
1 error generated.

or with gcc:

/tmp/fbcode_builder_getdeps-Z__wZGleanZGleanZhsthriftZbuildZfbcode_builder-root/repos/github.com-facebook-folly.git/folly/detail/base64_detail/tests/Base64PlatformTest.cpp: In function ‘constexpr std::array<unsigned char, 16> folly::detail::base64_detail::{anonymous}::expectedPackIndexesToBytes(std::array<unsigned char, 16>)’:
/tmp/fbcode_builder_getdeps-Z__wZGleanZGleanZhsthriftZbuildZfbcode_builder-root/repos/github.com-facebook-folly.git/folly/detail/base64_detail/tests/Base64PlatformTest.cpp:63:11: error: call to non-‘constexpr’ function ‘void std::array<_Tp, _Nm>::fill(const value_type&) [with _Tp = unsigned char; long unsigned int _Nm = 16; std::array<_Tp, _Nm>::value_type = unsigned char]’
   63 |   res.fill(0);
      |   ~~~~~~~~^~~

https://github.com/facebookincubator/Glean/runs/7550852020?check_suite_focus=true#step:15:540

I think we need some eyes on this as afaik folly won't build on stock github CI linux vms with gcc or clang due to this.

donsbot avatar Jul 28 '22 00:07 donsbot

Tentatively looks fixed by 8fcb145f659f2b2a70295bc979c164ed825fe8b2

donsbot avatar Jul 30 '22 23:07 donsbot

Nope, still borked on some variants.

The CXX compiler identification is Clang 12.0.1, https://github.com/donsbot/Glean/runs/7622200685?check_suite_focus=true#step:14:830

[348/901] Building CXX object CMakeFiles/base64_detail_test.dir/folly/detail/base64_detail/tests/Base64PlatformTest.cpp.o
FAILED: CMakeFiles/base64_detail_test.dir/folly/detail/base64_detail/tests/Base64PlatformTest.cpp.o 
/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 -DFOLLY_XLOG_STRIP_PREFIXES=\"/tmp/fbcode_builder_getdeps-Z__wZGleanZGleanZhsthriftZbuildZfbcode_builder-root/repos/github.com-facebook-folly.git:/tmp/fbcode_builder_getdeps-Z__wZGleanZGleanZhsthriftZbuildZfbcode_builder-root/build/folly\" -DGFLAGS_IS_A_DLL=0 -D_GNU_SOURCE -D_REENTRANT -I/tmp/fbcode_builder_getdeps-Z__wZGleanZGleanZhsthriftZbuildZfbcode_builder-root/repos/github.com-facebook-folly.git -I/tmp/fbcode_builder_getdeps-Z__wZGleanZGleanZhsthriftZbuildZfbcode_builder-root/build/folly -I/usr/include/libiberty -isystem /github/home/.hsthrift/include -march=corei7 -fsized-deallocation -O2 -g -DNDEBUG -g -std=gnu++1z -finput-charset=UTF-8 -fsigned-char -Wall -Wno-deprecated -Wno-deprecated-declarations -Wno-sign-compare -Wno-unused -Wuninitialized -Wunused-label -Wunused-result -Wno-noexcept-type -Wno-nullability-completeness -Wno-inconsistent-missing-override -faligned-new -fopenmp -DGTEST_HAS_PTHREAD=1 -std=gnu++17 -MD -MT CMakeFiles/base64_detail_test.dir/folly/detail/base64_detail/tests/Base64PlatformTest.cpp.o -MF CMakeFiles/base64_detail_test.dir/folly/detail/base64_detail/tests/Base64PlatformTest.cpp.o.d -o CMakeFiles/base64_detail_test.dir/folly/detail/base64_detail/tests/Base64PlatformTest.cpp.o -c /tmp/fbcode_builder_getdeps-Z__wZGleanZGleanZhsthriftZbuildZfbcode_builder-root/repos/github.com-facebook-folly.git/folly/detail/base64_detail/tests/Base64PlatformTest.cpp
/tmp/fbcode_builder_getdeps-Z__wZGleanZGleanZhsthriftZbuildZfbcode_builder-root/repos/github.com-facebook-folly.git/folly/detail/base64_detail/tests/Base64PlatformTest.cpp:60:40: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
constexpr std::array<std::uint8_t, 16> expectedPackIndexesToBytes(
                                       ^
/tmp/fbcode_builder_getdeps-Z__wZGleanZGleanZhsthriftZbuildZfbcode_builder-root/repos/github.com-facebook-folly.git/folly/detail/base64_detail/tests/Base64PlatformTest.cpp:63:7: note: non-constexpr function 'fill' cannot be used in a constant expression
  res.fill(0);
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/array:117:7: note: declared here
      fill(const value_type& __u)
      ^
1 error generated.

donsbot avatar Aug 02 '22 00:08 donsbot

And gcc 9: - The CXX compiler identification is GNU 9.4.0

/tmp/fbcode_builder_getdeps-Z__wZGleanZGleanZhsthriftZbuildZfbcode_builder-root/repos/github.com-facebook-folly.git/folly/detail/base64_detail/tests/Base64PlatformTest.cpp:63:11: error: call to non-‘constexpr’ function ‘void std::array<_Tp, _Nm>::fill(const value_type&) [with _Tp = unsigned char; long unsigned int _Nm = 16; std::array<_Tp, _Nm>::value_type = unsigned char]’
   63 |   res.fill(0);
      |   ~~~~~~~~^~~

donsbot avatar Aug 02 '22 00:08 donsbot

the folly linux CI step is failing with same reasons, btw. https://github.com/facebook/folly/runs/7400055532?check_suite_focus=true (as are downstream dependencies).

donsbot avatar Aug 04 '22 03:08 donsbot

@donsbot - I believe that specific issue is solved. Can we check again? I unfortunately don't know how to reproduce this locally.

DenisYaroshevskiy avatar Aug 04 '22 10:08 DenisYaroshevskiy

Yep! Looks solved. Thanks for pushing!

The folly Linux CI is still red though, as there's another build error that crept in while this one was active.

/home/runner/work/folly/folly/folly/concurrency/test/ThreadCachedSynchronizedBench.cpp: In function ‘void read_int_atomic(unsigned int)’:
/home/runner/work/folly/folly/folly/concurrency/test/ThreadCachedSynchronizedBench.cpp:55:30: error: class template argument deduction failed:
   folly::relaxed_atomic obj{3};
                              ^

donsbot avatar Aug 04 '22 10:08 donsbot

meet the same problem, g++ (GCC) 8.5.0 . CentOS Linux release 8.5.2111

Yejy813 avatar Dec 19 '23 09:12 Yejy813

meet the same problem, g++ (GCC) 8.5.0 . CentOS Linux release 8.5.2111

Can you clarify - which same problem? Can you share the error message? The static_assert was rewritten sometime back. Same as CTAD.

What's the issue in question?

DenisYaroshevskiy avatar Dec 19 '23 11:12 DenisYaroshevskiy

meet the same problem, g++ (GCC) 8.5.0 . CentOS Linux release 8.5.2111

Can you clarify - which same problem? Can you share the error message? The static_assert was rewritten sometime back. Same as CTAD.

What's the issue in question?

This is error screenshot.
image

I commented out this part of the code and then compiled it normally. image

Yejy813 avatar Dec 19 '23 13:12 Yejy813

meet the same problem, g++ (GCC) 8.5.0 . CentOS Linux release 8.5.2111

Can you clarify - which same problem? Can you share the error message? The static_assert was rewritten sometime back. Same as CTAD.

What's the issue in question?

sry. maybe wrong reply issue. hhhh

Yejy813 avatar Dec 19 '23 13:12 Yejy813