bazel-contrib / bazel-contrib/rules_foreign_cc

meson_with_requirements causes build configuration explode

Open
#1,236 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
737
Forks
270
PR merge metrics
No merged PRs in 30d

Description

When I build `glib` with `meson_with_requirements`, it causes `gettext` to be built 4 times with different configurations (should be 2 times.)

`gettext` is a dependency of both `glib` and `pango`, however, `meson_with_requirements` for `glib` altered the configuration and caused the `gettext` and all glib deps to be rebuilt with a different configuration.

```shell
$ bazel cquery "deps(@crate_index__pango-sys-0.18.0//:pango_sys)" 2>/dev/null | grep -v null | grep gettext
@gettext//:gettext (8dde3c6)
@gettext//:all_srcs (8dde3c6)
@gettext//:gettext (ed133b0)
@gettext//:all_srcs (ed133b0)
@gettext//:gettext (1780293)
@gettext//:gettext (b24e95e)
@gettext//:all_srcs (1780293)
@gettext//:all_srcs (b24e95e)

$ bazel config
INFO: Invocation ID: 3b4f8eb0-e201-4daf-ba5b-2890c17d1184
Available configurations:
17802932b6a4eb5f337b655c47f997cad22d9b9f436f85b2cb5374b717f0a4cf darwin_arm64-fastbuild-ST-b86257f8ac8a
6fc164df85bc99e66d42350bb39d3dad7e9adb8f5cc227617a6776a4833564a4 fastbuild-noconfig
8dde3c6671fd1eae6302202a64f6ae8597637551a7d074f3023664db1190c761 darwin_arm64-fastbuild
b24e95e1d34cbb9f5306fd2a5518d390aef846426ee27de1610b3ca9fd356563 darwin_arm64-opt-exec-ST-986096e16e03 (exec)
dca68f3e7ccfcedd40153ef299bce69c2b082aa321197fd13622c4e39d48a835 darwin_arm64-fastbuild
ed133b0adeb81be451527bbddd5609a8d8da1e6acccbde33b8b42a3a3010c501 darwin_arm64-opt-exec-ST-a828a81199fe (exec)
```

diff between `darwin_arm64-fastbuild` and `darwin_arm64-fastbuild-ST-b86257f8ac8a`

```diff
diff <(bazel config 8dde3c6 2>/dev/null) <(bazel config 1780293 2>/dev/null)
1,2c1,2
< BuildConfigurationValue 8dde3c6671fd1eae6302202a64f6ae8597637551a7d074f3023664db1190c761:
< Skyframe Key: BuildConfigurationKey[8dde3c6671fd1eae6302202a64f6ae8597637551a7d074f3023664db1190c761]
---
> BuildConfigurationValue 17802932b6a4eb5f337b655c47f997cad22d9b9f436f85b2cb5374b717f0a4cf:
> Skyframe Key: BuildConfigurationKey[17802932b6a4eb5f337b655c47f997cad22d9b9f436f85b2cb5374b717f0a4cf]
7c7
< extra_toolchains: []
---
> extra_toolchains: [@glib//:built_meson_toolchain_for_glib]
```

diff between `darwin_arm64-opt-exec-ST-986096e16e03` and `darwin_arm64-opt-exec-ST-a828a81199fe`.

```diff
diff <(bazel config b24e95e 2>/dev/null) <(bazel config ed133b0 2>/dev/null)
1,2c1,2
< BuildConfigurationValue b24e95e1d34cbb9f5306fd2a5518d390aef846426ee27de1610b3ca9fd356563:
< Skyframe Key: BuildConfigurationKey[b24e95e1d34cbb9f5306fd2a5518d390aef846426ee27de1610b3ca9fd356563]
---
> BuildConfigurationValue ed133b0adeb81be451527bbddd5609a8d8da1e6acccbde33b8b42a3a3010c501:
> Skyframe Key: BuildConfigurationKey[ed133b0adeb81be451527bbddd5609a8d8da1e6acccbde33b8b42a3a3010c501]
7c7
< extra_toolchains: [@glib//:built_meson_toolchain_for_glib]
---
> extra_toolchains: []
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the report with glib's meson_with_requirements and inspect the dependency graph using the shown bazel cquery command. Compare the affected configurations with bazel config, focusing on extra_toolchains. Done means shared gettext dependencies are configured and built only twice rather than four times.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.