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

no matching toolchains found for types @io_bazel_rules_scala//scala_proto:toolchain_type #768

Closed
luser opened this issue Jun 12, 2019 · 5 comments · Fixed by #1531
Closed

Comments

@luser
Copy link

luser commented Jun 12, 2019

I'm having an issue using scalapb_proto_library. I've built a simple reduced testcase project here: https://github.com/luser/bazel-scala-proto-test

I'm using bazel 0.26.1:

└─ $ ▶ bazel version
Build label: 0.26.1
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Jun 6 11:08:11 2019 (1559819291)
Build timestamp: 1559819291

The error is:

└─ $ ▶ bazel build :scala-proto-test
DEBUG: Rule 'io_bazel_rules_scala' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "8fe6f562da6469d5e67032ce3a9aa19a4cd312e8b284060e531c369067b3ceaa"
ERROR: Analysis of target '//:scala-proto-test' failed; build aborted: no matching toolchains found for types @io_bazel_rules_scala//scala_proto:toolchain_type
INFO: Elapsed time: 0.121s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)

I am very new to Bazel and I'm also not incredibly up-to-speed on Scala so it's possible I'm just doing something wrong, but I'd appreciate any help!

@luser luser changed the title o matching toolchains found for types @io_bazel_rules_scala//scala_proto:toolchain_type no matching toolchains found for types @io_bazel_rules_scala//scala_proto:toolchain_type Jun 12, 2019
@johnynek
Copy link
Member

You need to set up a toolchain. There is some documentation here:

https://github.com/bazelbuild/rules_scala/blob/master/docs/scalapb_proto_library.md#scalapb_proto_library

@luser
Copy link
Author

luser commented Jun 12, 2019

I did attempt to do that but it doesn't seem to be working:
https://github.com/luser/bazel-scala-proto-test/blob/f1aefee9cdfc806a3638b80193be1a4075e82a87/BUILD#L5-L18

@luser
Copy link
Author

luser commented Jun 13, 2019

So I tried reworking things with the other rules_scala and hit the same problem. After some fumbling around and reading the Bazel docs on toolchains I realized that toolchains need to be registered in WORKSPACE, and the other rules_scala provides a scala_proto_register_toolchains() to do so, which made things work. It looks like this project provides the same method, it's just not mentioned in the docs anywhere.

@luser
Copy link
Author

luser commented Jun 14, 2019

The solution that worked for me was to add this to WORKSPACE:

load("@io_bazel_rules_scala//scala_proto:toolchains.bzl", "scala_proto_register_toolchains")
scala_proto_register_toolchains()

It'd be great if the docs mentioned this!

@ittaiz
Copy link
Member

ittaiz commented Jun 14, 2019 via email

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

Successfully merging a pull request may close this issue.

3 participants