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

[FreeBSD] No matching toolchains found for types @bazel_tools//tools/jdk:runtime_toolchain_type #84

Closed
yesudeep opened this issue Jan 2, 2023 · 2 comments
Labels
P3 We're not considering to work on this, but happy to review a PR. (No assignee)

Comments

@yesudeep
Copy link

yesudeep commented Jan 2, 2023

I'm not sure but how would one add toolchains for FreeBSD?

This is what I see when using Bazel 6.0.0 on FreeBSD 14-CURRENT amd64:

Sun Jan 01 10:13 PM yesudeep at foo running bash5.2 on FreeBSD 14.0-CURRENT amd64
in ~/code/rules_clojure   main
>>> bazel build ...
ERROR: /usr/home/yesudeep/.cache/bazel/_bazel_yesudeep/bfaed87c32bc05637434339d5dc30c4b/external/bazel_tools~remote_coverage_tools_extension~remote_coverage_tools/BUILD:10:12: While resolving toolchains for target @bazel_tools~remote_coverage_tools_extension~remote_coverage_tools//:Main: No matching toolchains found for types @bazel_tools//tools/jdk:runtime_toolchain_type.
To debug, rerun with --toolchain_resolution_debug='@bazel_tools//tools/jdk:runtime_toolchain_type'
If platforms or toolchains are a new concept for you, we'd encourage reading https://bazel.build/concepts/platforms-intro.
ERROR: Analysis of target '//tests/hello_world:core_clojure_test' failed; build aborted:
INFO: Elapsed time: 0.203s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)

Thank you! :)

@yesudeep
Copy link
Author

yesudeep commented Jan 2, 2023

I fixed this by adding the local JDK toolchain configuration to my .bazelrc:

#common --experimental_enable_bzlmod
# Use the following after 6.0.0 is available on FreeBSD.
common --enable_bzlmod

# See: https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config
build --enable_platform_specific_config

# See: https://bazel.build/docs/bazel-and-java
build:freebsd --extra_toolchains=@local_jdk//:all

# FreeBSD requires this because rules_java doesn't have a remote JDK for FreeBSD.
build:freebsd --java_runtime_version=local_jdk
build:freebsd --tool_java_runtime_version=local_jdk

Would still be nice if one didn't need to do this. Thank you! :)

@hvadehra
Copy link
Member

Using a remote jdk by default for executing tools was a deliberate decision, see #179 (comment) for details.

bazelbuild/bazel#21752 (comment) has some more info on forcing Bazel to use the local jdk for everything.

@hvadehra hvadehra closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering to work on this, but happy to review a PR. (No assignee)
Projects
None yet
Development

No branches or pull requests

2 participants