abseil / abseil/abseil-cpp

[Bug]: CMake pkgconfig misgeneration for random_mocking_bit_gen

Ouverte
#1,528 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
C++
Étoiles
18.1k
Forks
3.2k
Merge moyen
20 h 36 min
PR mergées (30 j)
1

Description

### 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
```
3. 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?

```
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](https://github.com/protocolbuffers/protobuf/releases/tag/v24.2) tests in full as a part of the package for that.
```diff
--- 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
```

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.