bazelbuild / bazelbuild/rules_rust
provide transition to override path to runfiles
- Dominant language
- Starlark
- Stars
- 843
- Forks
- 651
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 15
Description
It's sometimes useful to be able to relocate files in a container image. That breaks the default `rpath` produced by the build process, as introduced by the `--codegen=link-arg=-Wl,-rpath` flags.
It'd be neat to be able to transition a build subgraph to use a different relative `rpath` (the part between `$ORIGIN` and the `.runfiles` path suffix). For example, my binary currently embeds
```
0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../../../../../../../_solib_k8/_U_A_Arust_Ucrate_Uindex_Ufips_U_Uaws-lc-fips-sys-0.13.9_S_S_Ccrypto___Uexternal_Srust_Ucrate_Uindex_Ufips_U_Uaws-lc-fips-sys-0.13.9:$ORIGIN/../../../../../../../_solib_k8/_U_A_Arust_Ucrate_Uindex_Ufips_U_Uaws-lc-fips-sys-0.13.9_S_S_Crust_Uwrapper___Uexternal_Srust_Ucrate_Uindex_Ufips_U_Uaws-lc-fips-sys-0.13.9]
```
and I would like to eliminate all the `../` path components in favor of just `$ORIGIN/_solib_k8/_U_A_Arust_Ucrate_Uindex_Ufips_U_Uaws-lc-fips-sys-0.13.9_S_S_Ccrypto___Uexternal_Srust_Ucrate_Uindex_Ufips_U_Uaws-lc-fips-sys-0.13.9`.
I'm not convinced this is a _good_ idea, but I'm also not convinced it's a bad idea either. It's possible that this should be handled by [`patchelf`](https://github.com/NixOS/patchelf) post-processing, since that avoids recompiling the entire `rust_binary` when all that needs to change is a single string.
Thoughts?
Contributor guide
Assessment
This issue has not been assessed yet.