Skip to content

Bazel 5: no matching toolchains found for types @bazel_tools//tools/jdk:runtime_toolchain_type #14864

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

Closed
devhanos5 opened this issue Feb 18, 2022 · 4 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-Java Issues for Java rules type: support / not a bug (process)

Comments

@devhanos5
Copy link

devhanos5 commented Feb 18, 2022

Description of the problem / feature request:

We override the remotejdk11_macos with on-prem URLs. The same works on Bazel 4 but errors out with the following message on Bazel 5. This is not an issue with Bazel but I would appreciate if someone can help with what extra steps are needed to make it work.

While resolving toolchains for target @bazel_tools//tools/jdk:remote_jdk11: no matching toolchains found for types @bazel_tools//tools/jdk:runtime_toolchain_type

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

repro.zip

repro directory

  • bazel4.2.2
  • bazel5

Steps:

  1. Go to repro/bazel4.2.2. Execute ./bazel-4.2.2-darwin-x86_64 build :ExampleLib. The build will be successful.
  2. Go to repro/bazel5. Execute ./bazel-5.0.0-darwin-x86_64 build :ExampleLib. The build will fail with the following error:
ERROR: /private/var/tmp/_bazel_devh/c6ae263ac387a0f59fbd632245d48237/external/bazel_tools/tools/jdk/BUILD:474:27: While resolving toolchains for target @bazel_tools//tools/jdk:remote_jdk11: no matching toolchains found for types @bazel_tools//tools/jdk:runtime_toolchain_type
ERROR: Analysis of target '//:ExampleLib' failed; build aborted: 
INFO: Elapsed time: 4.268s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (34 packages loaded, 313 targets configured)
    Fetching @local_config_cc; Running xcode-locator

What operating system are you running Bazel on?

OS: macOS Big Sur 11.6
Bazel 4.2.2, 5.0.0

What's the output of bazel info release?

release 5.0.0

Any other information, logs, or outputs that you want to share?

NA

@devhanos5 devhanos5 changed the title no matching toolchains found for types @bazel_tools//tools/jdk:runtime_toolchain_type Bazel 5: no matching toolchains found for types @bazel_tools//tools/jdk:runtime_toolchain_type Feb 18, 2022
@aiuto aiuto added team-Rules-Java Issues for Java rules untriaged labels Feb 26, 2022
@limdor
Copy link
Contributor

limdor commented Feb 27, 2022

Maybe related to #7849?

@comius comius added type: support / not a bug (process) P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Mar 4, 2022
@comius
Copy link
Contributor

comius commented Mar 4, 2022

The WORKSPACE files have changed because of Java toolchainisation. See https://github.com/bazelbuild/bazel/blob/5.0.0/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.tmpl#L87-L100

Nonetheless the same override trick should work with some changes:

load("@bazel_tools//tools/jdk:remote_java_repository.bzl", "remote_java_repository")

remote_java_repository(
  name = "remotejdk11_macos",
  sha256 = "e1fe56769f32e2aaac95e0a8f86b5a323da5af3a3b4bba73f3086391a6cc056f",
  strip_prefix = "zulu11.50.19-ca-jdk11.0.12-macosx_x64",
  urls = [
    "https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-macosx_x64.tar.gz",
  ],
  target_compatible_with = [
        "@platforms//os:macos",
        "@platforms//cpu:x86_64",
  ],
  version = "11",
)

@github-actions
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Jun 14, 2023
@github-actions
Copy link

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team (@bazelbuild/triage). Thanks!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-Java Issues for Java rules type: support / not a bug (process)
Projects
None yet
Development

No branches or pull requests

4 participants