abseil / abseil-cpp

Abseil Common Libraries (C++)
https://abseil.io
Apache License 2.0
14.91k stars 2.61k forks source link

[Bug]: test build issues in LTS 20220623.1 #1359

Open AlexK-BD opened 1 year ago

AlexK-BD commented 1 year ago

Describe the issue

When trying to run bazel test @com_google_absl://..., I encountered two build issues:

absl/hash/hash_test.cc

external/com_google_absl/absl/hash/hash_test.cc: In instantiation of 'struct {anonymous}::IsAggregateInitializable<absl::lts_20220623::hash_internal::Hash<{anonymous}::IsHashableTest_PoisonHash_Test::TestBody()::X> >':
external/com_google_absl/absl/hash/hash_test.cc:909:3:   required from here
external/com_google_absl/absl/hash/hash_test.cc:884:22: error: use of deleted function 'absl::lts_20220623::hash_internal::PoisonedHash::PoisonedHash()'
     : std::true_type {};
                      ^
In file included from external/com_google_absl/absl/hash/hash.h:85,
                 from external/com_google_absl/absl/hash/hash_test.cc:15:
external/com_google_absl/absl/hash/internal/hash.h:1208:3: note: declared here
   PoisonedHash() = delete;
   ^~~~~~~~~~~~
external/com_google_absl/absl/hash/hash_test.cc:884:22: error: use of deleted function 'absl::lts_20220623::hash_internal::PoisonedHash::PoisonedHash()'
     : std::true_type {};
                      ^
In file included from external/com_google_absl/absl/hash/hash.h:85,
                 from external/com_google_absl/absl/hash/hash_test.cc:15:
external/com_google_absl/absl/hash/internal/hash.h:1208:3: note: declared here
   PoisonedHash() = delete;
   ^~~~~~~~~~~~

This problem only seems to occur when building with -std=gnu++17. The line in question has a comment about GCC since version 9, so it's possible that GCC version 8 with gnu++17 has the same problem.

absl/flags/flag_benchmark.cc

Long error spew, but all coming from the same line:

external/com_google_absl/absl/flags/flag_benchmark.cc:246:62: error: no matching function for call to 'DoNotOptimize(bool (&)())'
   int odr##T = (benchmark::DoNotOptimize(AbslInvokeGetFlag##T), 1);
                                                              ^
external/com_google_absl/absl/flags/flag_benchmark.cc:88:3: note: in expansion of macro 'InvokeGetFlag'
   A(bool)                    \
   ^
external/com_google_absl/absl/flags/flag_benchmark.cc:248:1: note: in expansion of macro 'BENCHMARKED_TYPES'
 BENCHMARKED_TYPES(InvokeGetFlag)
 ^~~~~~~~~~~~~~~~~

(rest omitted)

The master branch has a fix for this in 553491a54cdb842ab583942e1058cbdcedd32018 which references issue #1340

Steps to reproduce the problem

First issue:

git checkout lts_2022_06_23
env  CC=/usr/bin/gcc-8 bazel test --cxxopt=-std=gnu++17 //absl/hash/...

Second issue needs a newer version of benchmark; update WORKSPACE:

http_archive(
    name = "com_github_google_benchmark",  # 2021-09-20T09:19:51Z
    sha256 = "6430e4092653380d9dc4ccb45a1e2dc9259d581f4866dc0759713126056bc1d7",
    strip_prefix = "benchmark-1.7.1",
    urls = ["https://github.com/google/benchmark/archive/refs/tags/v1.7.1.tar.gz"],
)

Then build:

env  CC=/usr/bin/gcc-8 bazel build //absl/flags/...

What version of Abseil are you using?

8c0b94e793a66495e0b1f34a5eb26bd7dc672db0 (lts_2022_06_23, tag: 20220623.1)

What operating system and version are you using?

Ubuntu 18.04

What compiler and version are you using?

Using built-in specs.
COLLECT_GCC=gcc-8
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 8.4.0-1ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.4.0 (Ubuntu 8.4.0-1ubuntu1~18.04)

What build system are you using?

bazel 6.0.0 and bazel 5.3.1

Additional context

No response

derekmauro commented 1 year ago

absl/hash/hash_test.cc

external/com_google_absl/absl/hash/hash_test.cc: In instantiation of 'struct {anonymous}::IsAggregateInitializable<absl::lts_20220623::hash_internal::Hash<{anonymous}::IsHashableTest_PoisonHash_Test::TestBody()::X> >':
external/com_google_absl/absl/hash/hash_test.cc:909:3:   required from here
external/com_google_absl/absl/hash/hash_test.cc:884:22: error: use of deleted function 'absl::lts_20220623::hash_internal::PoisonedHash::PoisonedHash()'
     : std::true_type {};
                      ^
In file included from external/com_google_absl/absl/hash/hash.h:85,
                 from external/com_google_absl/absl/hash/hash_test.cc:15:
external/com_google_absl/absl/hash/internal/hash.h:1208:3: note: declared here
   PoisonedHash() = delete;
   ^~~~~~~~~~~~
external/com_google_absl/absl/hash/hash_test.cc:884:22: error: use of deleted function 'absl::lts_20220623::hash_internal::PoisonedHash::PoisonedHash()'
     : std::true_type {};
                      ^
In file included from external/com_google_absl/absl/hash/hash.h:85,
                 from external/com_google_absl/absl/hash/hash_test.cc:15:
external/com_google_absl/absl/hash/internal/hash.h:1208:3: note: declared here
   PoisonedHash() = delete;
   ^~~~~~~~~~~~

This problem only seems to occur when building with -std=gnu++17. The line in question has a comment about GCC since version 9, so it's possible that GCC version 8 with gnu++17 has the same problem.

It looks like the first issue worked in GCC 8.3 and was broken by GCC 8.4. I'm not sure, but it's possible that GCC 8.4 wasn't released at the time.

The second issue already has a fix.

I'm not sure either of these issues are severe enough to warrant an LTS patch. Are they causing issues for you?

A new LTS will be cut very soon.

AlexK-BD commented 1 year ago

We use a local mirror/fork repo of abseil, so I've deployed these fixes to a branch there already. So really, so long as things get fixed eventually (so that my changes on top of stock LTS don't keep piling up over time and I can easily pull upstream) this is not an issue.