abseil/abseil-cpp

[Bug]: CMake pkgconfig misgeneration for random_mocking_bit_gen

Opened this issue · 2 comments

Describe the issue

Building abseil-cpp 20230802.0 with -DABSL_BUILD_TEST_HELPERS=ON (and -DABSL_USE_EXTERNAL_GOOGLETEST=ON for using distro provided gtest 1.14.0 development files) yielded the following error when nearing the end of the Chimera Linux package build:

=> abseil-cpp-devel-20230802.0-r1: running pre_pkg hook: 001_runtime_deps...
=> abseil-cpp-devel-20230802.0-r1: ERROR:    pc: absl_random_internal_mock_overload_set=20230802 <-> UNKNOWN PACKAGE!

Whole build log looks like https://paste.c-net.org/ba0pf3edkbzi

Dropping https://github.com/abseil/abseil-cpp/blob/20230802.0/absl/random/CMakeLists.txt#L115 (from absl_random_mocking_bit_gen.pc's Requires: list) alone fixes this, and as random_internal_mock_overload_set declared just above itself mentions:

Internal-only target, do not depend on directly.

Is there a real problem with the current code that cbuild happened to detect by reading the pkgconfig files? Indeed a absl_random_internal_mock_overload_set.pc does not exist as it doesn't define itself as a PUBLIC library for a reason from what I can tell.

Steps to reproduce the problem

  1. Run either https://chimera-linux.org/ or any Linux distro with apk v3 binary setup in $PATH from https://repo.chimera-linux.org/apk/
  2. Run the commands to attempt building from https://github.com/JamiKettunen/cports/tree/abseil-cpp-test-helpers:
git clone https://github.com/JamiKettunen/cports -b abseil-cpp-test-helpers
cd cports
./cbuild keygen
./cbuild binary-bootstrap
./cbuild pkg main/abseil-cpp
  1. See problem as described above

What version of Abseil are you using?

20230802.0

What operating system and version are you using?

Linux, any distro with static apk v3 in $PATH or https://chimera-linux.org/ itself

What compiler and version are you using?

root@cbuild: ~$ clang -v
clang version 16.0.6
Target: x86_64-chimera-linux-musl
Thread model: posix
InstalledDir: /usr/bin
System configuration file directory: /etc/clang

What build system are you using?

root@cbuild: ~$ cmake --version
cmake version 3.27.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).
root@cbuild: ~$ ninja --version
1.11.1

Additional context

The patch below makes my abseil-cpp Chimera Linux packaging succeed and I can at least build and run protobuf v24.2 tests in full as a part of the package for that.

--- a/absl/random/CMakeLists.txt
+++ b/absl/random/CMakeLists.txt
@@ -112,7 +112,6 @@ absl_cc_library(
     absl::raw_logging_internal
     absl::random_distributions
     absl::random_internal_distribution_caller
-    absl::random_internal_mock_overload_set
     absl::random_random
     absl::strings
     absl::span

As a part of enabling tests (-DABSL_BUILD_TESTING=ON) I noticed the patch I proposed wasn't needed, so this issue affects -DABSL_BUILD_TESTING=OFF -DABSL_BUILD_TEST_HELPERS=ON builds