Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using locally installed rust toolchain #2275

Open
blackgnezdo opened this issue Nov 21, 2023 · 2 comments
Open

Using locally installed rust toolchain #2275

blackgnezdo opened this issue Nov 21, 2023 · 2 comments

Comments

@blackgnezdo
Copy link

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?

@UebelAndre
Copy link
Collaborator

Something we could do is add a repository rule that allows you to set local paths to files that get symlinked into an external repository that can then be used in a toolchain. I'd be happy to review a PR for that 😄

@blackgnezdo
Copy link
Author

OK, maybe I will feel inspired enough some day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants