abseil / abseil-cpp

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

[Bug]: CMake pkgconfig misgeneration for random_mocking_bit_gen #1528

Open JamiKettunen opened 1 year ago

JamiKettunen commented 1 year ago

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
  3. 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
zpassanger commented 1 year ago

I don't need users everyday kind satisfied with the current location of that one but I don't need them at all but Arizona for good not the best I can do ever since it I go šŸ”™

On Sun, Sep 3, 2023, 10:41 AM Jami Kettunen @.***> wrote:

Describe the issue

Building abseil-cpp 20230802.0 https://github.com/abseil/abseil-cpp/releases/tag/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 https://github.com/JamiKettunen/cports/tree/abseil-cpp-test-helpers/main/abseil-cpp 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 https://github.com/abseil/abseil-cpp/blob/fc44fa0/absl/random/CMakeLists.txt#L84-L98 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 https://github.com/abseil/abseil-cpp/releases/tag/20230802.0 What operating system and version are you using?

Linux, any distro with static apk v3 https://repo.chimera-linux.org/apk/ in $PATH or https://chimera-linux.org/ itself What compiler and version are you using?

@.***: ~$ 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?

@.***: ~$ cmake --version cmake version 3.27.4

CMake suite maintained and supported by Kitware (kitware.com/cmake). @.***: ~$ 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 https://github.com/protocolbuffers/protobuf/releases/tag/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

ā€” Reply to this email directly, view it on GitHub https://github.com/abseil/abseil-cpp/issues/1528, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHXPKAO5GCYKZD7NEOK6TL3XYS6OLANCNFSM6AAAAAA4JOP5SE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

JamiKettunen commented 12 months ago

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