bazelbuild / bazelbuild/rules_rust

C++ deps double-building on cargo_build_script targets

Open
#2,026 1 comment 2 reactions 0 assignees View on GitHub
bug cargo needs-triage
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

Right now, if we need to get a linker search path in a build script (e.g. to set `$OPENSSL_DIR`), we typically end up double-compiling C++ deps.

Typically one add a `compile_data` dep which is actually linked against. But one also adds a `build_script_data` dep which is just present so we can refer to the target in an `$(execpath)` macro in the cargo build script.

Because the `cargo_build_script` is compiled in the exec configuration, its data ends up being compiled in the exec configuration just so that we can extract a path.

While we could fake out these paths somehow, ideally the `cargo_build_script` machinery would allow us to pass a target-configured dep as data so we can `$(execpath)` it for the purposes of the dependent target.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.