Ensure dynamic library dependencies end up in the runfiles directory (#2671)

Right now the runfiles directory only contains "data" that is attached
to a rust_binary() or one of its dependencies. This is inconsistent with
cc_binary() and go_binary(), which also include an `_solib_*/` directory
containing shared library dependencies.

When doing a plain 'bazel run' against the resulting executable, this is
not a noticeable issue. The reason being that the runtime dynamic linker
will use `${execroot}/_solib_*`. However, it does become a problem when
`pkg_tar(include_runfiles = True)` is used to construct an archive of
the binary so that it can be placed in a container image.

This change extends the runfiles gathering logic to merge all
LibraryToLink.dynamic_library files in there as well.
4 files changed
tree: b6a86aa973e144499b808d88c22c496bb32f90b2
  1. .bazelci/
  2. .bcr/
  3. .github/
  4. bindgen/
  5. cargo/
  6. crate_universe/
  7. docs/
  8. examples/
  9. ffi/
  10. nix/
  11. proto/
  12. rust/
  13. test/
  14. tools/
  15. util/
  16. wasm_bindgen/
  17. .bazelignore
  18. .bazelrc
  19. .clang-format
  20. .envrc
  21. .gitattributes
  22. .gitignore
  23. .prettierrc.toml
  24. .rustfmt.toml
  25. ARCHITECTURE.md
  26. AUTHORS
  27. BUILD.bazel
  28. CODEOWNERS
  29. COMPATIBILITY.md
  30. CONTRIBUTING.md
  31. CONTRIBUTORS
  32. LICENSE.txt
  33. MODULE.bazel
  34. README.md
  35. version.bzl
  36. WORKSPACE.bazel
README.md

Rust Rules

  • Postsubmit Build status

Overview

This repository provides rules for building Rust projects with Bazel.

Community

General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust.

Documentation

Please refer to the full documentation.