Support omitting automatic rpaths for packaged Linux rust_binary outputs
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 46/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- rust
- 領域
- build-system
調査の方向性
Read rustc_compile_action and get_linker_and_args to trace how automatic rpaths reach the linker, then inspect the planned configurability redesign in #4049. Add a regression test comparing default automatic paths with opted-in authored paths and checking refusal when dynamic Rust std is enabled; confirm the public option’s scope with the maintainers.
索引モデルが issue の本文から書いたものです。
説明
Linux distribution binaries need a way to omit Bazel's automatically computed runtime library paths while preserving explicitly authored linker flags.
A concrete packaging layout is bin/app plus lib/libdependency.so. We compile with static Rust std, copy the executable and its declared shared libraries into an OCI image, and want the sole runtime search path to be $ORIGIN/../lib. Paths into Bazel's _solib and runfiles trees do not exist in that image.
With rules_rust 0.74.0, rustc_compile_action computes rpaths from native dependencies and passes them into get_linker_and_args. Adding an explicit path through rustc_flags preserves the automatic paths too. Disabling the C++ runtime_library_search_directories feature is not a suitable general solution: the configured C++ link action can require that feature during analysis.
We currently use a small downstream correction: a boolean on rust_binary, default false, which leaves the C++ feature configuration intact but passes an empty rpath depset to the linker for an opted-in binary. It preserves user-authored linker flags and normal build-script/proc-macro linking. Our current implementation refuses non-Linux binaries and link_std_dylib=True, so it does not silently break dynamic Rust std loading.
For example, a possible public interface would be:
rust_binary(
name = "app",
srcs = ["main.rs"],
deps = [":shared_native_dependency"],
relocatable_binary = True,
rustc_flags = ["-Clink-arg=-Wl,-rpath,$$ORIGIN/../lib"],
)
Validation of the downstream correction includes ARM64 ELF dynamic-section checks after copying out of the execroot, startup of every packaged executable in the exact runtime image, and a backend query that executes packaged V8. The default behavior remains unchanged. These checks were executed against the pinned 0.74.0 correction; I am not claiming execution against upstream main.
I checked main at bbeacc846555ffe6738ad79ea3013f2c255c8081 and the same automatic-rpath path remains. Before proposing a public attribute, as CONTRIBUTING.md requests, would you prefer this narrowly scoped option, an existing supported configuration that I missed, or a hook in the planned configurability redesign (#4049)? A regression test should compare default automatic paths with opted-in authored paths and verify refusal for dynamic Rust std.
Assisted-by: OpenAI Codex
- 主要言語
- Starlark
- スター
- 857
- フォーク
- 701
- 平均マージ
- 4日 7時間
- マージ済み PR(30日)
- 46
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bazelbuild/rules_rust のほかの issue
-
`rust_test(crate = ...)` does not stage the crate's transitive dynamic libraries into runfiles対応中かも @Wito-1 が 65 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
bazelbuild/rules_rust#4309 ·
メンテナーはふだん 3 日以内に返信
-
Windows (no-symlink path): drain_runfiles_dir_windows deletes retained runfiles — inverted filename_suffixes_to_retain condition対応中かも @Mattbusel が 17 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
bazelbuild/rules_rust#4266 ·
メンテナーはふだん 3 日以内に返信
-
rust.toolchain(strip_level = ...) is silently ignored対応中かも @Mattbusel が 17 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
bazelbuild/rules_rust#4223 ·
メンテナーはふだん 3 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100
bazelbuild/rules_rust#4152 · リアクション 1 件 ·
メンテナーはふだん 3 日以内に返信
-
awaiting-response
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bazelbuild/rules_rust#3599 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
bazelbuild/rules_rust の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
bazelbuild/apple_support#707 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
out-of-date
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CachyOS/CachyOS-PKGBUILDS#2232 ·
メンテナーはふだん 1 日以内に返信
-
blast/large refactor risk/low spend-dem
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chriskelly/MusicWall#87 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
neilotoole/sq#1503 ·
メンテナーはふだん 1 日以内に返信