Support omitting automatic rpaths for packaged Linux rust_binary outputs
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 46/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- rust
- Lĩnh vực
- build-system
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Starlark
- Star
- 857
- Fork
- 701
- Merge trung bình
- 4 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 46
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bazelbuild/rules_rust
-
`rust_test(crate = ...)` does not stage the crate's transitive dynamic libraries into runfilesCó thể đã có người làm @Wito-1 đã nhận 66 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
bazelbuild/rules_rust#4309 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Windows (no-symlink path): drain_runfiles_dir_windows deletes retained runfiles — inverted filename_suffixes_to_retain conditionCó thể đã có người làm @Mattbusel đã nhận 17 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
bazelbuild/rules_rust#4266 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
rust.toolchain(strip_level = ...) is silently ignoredCó thể đã có người làm @Mattbusel đã nhận 17 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
bazelbuild/rules_rust#4223 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 90/100
bazelbuild/rules_rust#4152 · 1 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
awaiting-response
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
bazelbuild/rules_rust#3599 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của bazelbuild/rules_rust
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
bazelbuild/apple_support#707 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
blocky: new version 0.38.0Đang mởout-of-date
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CachyOS/CachyOS-PKGBUILDS#2232 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
blast/large refactor risk/low spend-dem
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
chriskelly/MusicWall#87 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
neilotoole/sq#1503 ·
Maintainer thường phản hồi trong vòng 1 ngày