Skip to content

Using locally installed rust toolchain #2275

Open
@blackgnezdo

Description

@blackgnezdo

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions