Skip to content

Commit

Permalink
[bazel] update rules_rust to add patch for specifying ld location
Browse files Browse the repository at this point in the history
This updates rules_rust to make use of a new patch that was added in the
lowRISC fork of rules_rust that enables a workaround for
lowRISC#12448.

The workaround provides a command line build flag
`--@rules_rust//:extra_rustc_toolchain_dirs=/path/to/somewhere/else` that
you can add to your `.bazelrc` file to specify a different location on your
system where host toolchain tools may be found.

Signed-off-by: Tim Trippel <[email protected]>
  • Loading branch information
timothytrippel committed Sep 16, 2023
1 parent 3451d3b commit 6220920
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions doc/contributing/bazel_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,11 @@ Specifically, when the rustc compiler is invoked, it uses the LLVM linker that i
This means bazel cannot ensure it is installed at a specific location, and instead just uses whatever is available on the host machine.
The issue above points out that rustc expects the linker to be located in the same directory as `gcc`, so if on the host machine this statement is untrue, there can be build issues.

To resolve this problem:
To resolve this problem, you can either:
1. Install the LLVM linker with, e.g., `sudo apt install lld`.
2. Symlink `lld` to where `gcc` is installed.

This workaround will be needed until the rust issue is resolved.
or,
1. add the build flag `--@rules_rust//:extra_rustc_toolchain_dirs=/path/to/somewhere/else` to your `.bazelrc` file to specify a different location on your system where host toolchain tools may be found.

Either of these workarounds will be needed until the `rules_rust` issue is resolved.
6 changes: 3 additions & 3 deletions third_party/rust/repos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ def rust_repos(rules_rust = None, safe_ftdi = None, serde_annotate = None):
http_archive_or_local(
name = "rules_rust",
local = rules_rust,
sha256 = "a5cd81f9ffbe4dfff73767ecc1f5469d17f4f819fd4bc6b482fd775c6b08b11f",
strip_prefix = "rules_rust-rebase-20230822_01",
url = "https://github.com/lowRISC/rules_rust/archive/refs/tags/rebase-20230822_01.tar.gz",
sha256 = "e85891dd6bb24e877a9622c09f028b9e11c0f4df69db4735194eb1d8dc7ae917",
strip_prefix = "rules_rust-rebase-20230822_02",
url = "https://github.com/lowRISC/rules_rust/archive/refs/tags/rebase-20230822_02.tar.gz",
)

http_archive_or_local(
Expand Down

0 comments on commit 6220920

Please sign in to comment.