bazelbuild / bazelbuild/rules_rust

Using locally installed rust toolchain

Open
#2,275 3 comments 0 reactions 0 assignees View on GitHub
enhancement needs-triage
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

I am trying to use `rules_rust` on OpenBSD which is currently not supported. I read the docs to the point of discovering `rust_toolchain` which seems to fit the pattern. Sadly my attempt is currently failing with:
```
$ bazel build --extra_toolchains=//bazel:rust_openbsd :a
...
INFO: Build option --extra_toolchains has changed, discarding analysis cache.
Analyzing: target //:a (0 packages loaded, 0 targets configured)
ERROR: /home/greg/s/rop/bazel/BUILD:3:15: //bazel:rust_openbsd_impl: invalid label '/usr/local/bin/rustdoc' in attribute 'rust_doc' in 'rust_toolchain' rule: invalid target name '/usr/local/bin/rustdoc': target names may not start with '/'
ERROR: /home/greg/s/rop/bazel/BUILD:3:15: //bazel:rust_openbsd_impl: invalid label '/usr/local/bin/rust_std' in attribute 'rust_std' in 'rust_toolchain' rule: invalid target name '/usr/local/bin/rust_std': target names may not start with '/'
ERROR: /home/greg/s/rop/bazel/BUILD:3:15: //bazel:rust_openbsd_impl: invalid label '/usr/local/bin/rustc' in attribute 'rustc' in 'rust_toolchain' rule: invalid target name '/usr/local/bin/rustc': target names may not start with '/'
ERROR: /home/greg/s/rop/bazel/BUILD:3:15: //bazel:rust_openbsd_impl: invalid label '/usr/local/bin/rustc_lib' in attribute 'rustc_lib' in 'rust_toolchain' rule: invalid target name '/usr/local/bin/rustc_lib': target names may not start with '/'
ERROR: /home/greg/s/rop/bazel/BUILD:3:15: //bazel:rust_openbsd_impl: missing value for mandatory attribute 'rust_doc' in 'rust_toolchain' rule
ERROR: /home/greg/s/rop/bazel/BUILD:3:15: //bazel:rust_openbsd_impl: missing value for mandatory attribute 'rust_std' in 'rust_toolchain' rule
ERROR: /home/greg/s/rop/bazel/BUILD:3:15: //bazel:rust_openbsd_impl: missing value for mandatory attribute 'rustc' in 'rust_toolchain' rule
ERROR: /home/greg/s/rop/BUILD:3:12: While resolving toolchains for target //:a: invalid registered toolchain '//bazel:rust_openbsd': Error evaluating '//bazel:rust_openbsd': error loading package 'bazel': Package 'bazel' contains errors
ERROR: Analysis of target '//:a' failed; build aborted:
```

The code is available at https://github.com/blackgnezdo/rop.

What's the easiest way to build rust programs with a local toolchain?

If that's not the way to go, how do I extend `rules_rust` to add support for OpenBSD? I could conceivably host the bundle, or just keep a directory around and reference it with `local_repository`. What's the recipe for building the toolchain bundles?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.