bazel: `toolchain_vanilla` works with locally defined jdk 11, but `toolchain_java11` breaks the jdk compiler
Description of the problem / feature request:
Building in Java 11 works using toolchain_vanilla
, but changing to toolchain_java11
does not compile due to a JDK bug (that should be fixed). Does the toolchain_java11 not use a locally defined host_javabase
and javabase
?
I assume that the vanilla one is using the local, but does that change to remote if i use toolchain_java11? Is there any way to change this so that I can define the jdk to use in that toolchain?
We define things like this in our .bazelrc:
build --define=ABSOLUTE_JAVABASE=//tools:jdk11
build --javabase=//tools:jdk11
build --host_javabase=//tools:jdk11
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_java11
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_java11
The jdk11
we use is this (via an alias)
http_archive(
name = "jdk11_linux",
build_file_content = "java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])",
sha256 = "3b1c0c34be4c894e64135a454f2d5aaa4bd10aea04ec2fa0c0efe6bb26528e30",
strip_prefix = "jdk-11.0.13+8",
urls = ["https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.13%2B8/OpenJDK11U-jdk_x64_linux_hotspot_11.0.13_8.tar.gz"],
)
Feature requests: what underlying problem are you trying to solve with this feature?
Get our build to work.
Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I think that it might have to do with our own giant code base, so it’s not easily reproducible that I’ve found.
What operating system are you running Bazel on?
Linux - Ubuntu 21.04
What’s the output of bazel info release
?
release 1.2.1
Have you found anything relevant by searching the web?
Yes, it looks like the bug we are hitting is a bug in the JDK: https://bugs.openjdk.java.net/browse/JDK-8210483
Any other information, logs, or outputs that you want to share?
(06:53:41) ERROR: XXX/BUILD:5:1: Building XXX-class.jar (2277 source files) and running annotation processors (AnnotationProcessorHider$AnnotationProcessor, AnnotationDependsOnProcessor) failed (Exit 1)
compiler message file broken: key=compiler.misc.msg.bug arguments=11.0.13, {1}, {2}, {3}, {4}, {5}, {6}, {7}
java.lang.AssertionError
at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$2$1.setOverloadKind(
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (9 by maintainers)
Commits related to this issue
- Remove custom jdk_compiler and java_compiler jars The javac changes that Bazel depends on are now available in the latest JDK 11 update release. https://github.com/bazelbuild/bazel/issues/14533 — committed to cushon/bazel by cushon 2 years ago
- Update to latest available JDK 11 update releases The new binaries are: ``` e064b61d93304012351242bf0823c6a2e41d9e28add7ea7f05378b7243d34247 https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-... — committed to bazelbuild/bazel by cushon 2 years ago
- Remove custom jdk_compiler and java_compiler jars The javac changes that Bazel depends on are now available in the latest JDK 11 update release. https://github.com/bazelbuild/bazel/issues/14533 — committed to cushon/bazel by cushon 2 years ago
- Remove custom jdk_compiler and java_compiler jars The javac changes that Bazel depends on are now available in the latest JDK 11 update release. https://github.com/bazelbuild/bazel/issues/14533 — committed to cushon/bazel by cushon 2 years ago
- Remove custom jdk_compiler and java_compiler jars The javac changes that Bazel depends on are now available in the latest JDK 11 update release. https://github.com/bazelbuild/bazel/issues/14533 Clo... — committed to bazelbuild/bazel by cushon 2 years ago
- Remove custom jdk_compiler and java_compiler jars This is the third_party part of 18c17dab8fece0a02b53911711ebba497e7fea2a https://github.com/bazelbuild/bazel/issues/14533 — committed to cushon/bazel by cushon 2 years ago
- Remove custom jdk_compiler and java_compiler jars This is the third_party part of 18c17dab8fece0a02b53911711ebba497e7fea2a https://github.com/bazelbuild/bazel/issues/14533 Partial commit for third_... — committed to bazelbuild/bazel by cushon 2 years ago
- Remove javac jars This is the third_party part of https://github.com/bazelbuild/bazel/pull/15319 https://github.com/bazelbuild/bazel/issues/14533 — committed to cushon/bazel by cushon 2 years ago
- Remove langtools jars Follow-up to https://github.com/bazelbuild/bazel/pull/15303 https://github.com/bazelbuild/bazel/issues/14533 Closes #15319. PiperOrigin-RevId: 444583929 — committed to bazelbuild/bazel by cushon 2 years ago
- Remove javac jars This is the third_party part of https://github.com/bazelbuild/bazel/pull/15319 https://github.com/bazelbuild/bazel/issues/14533 — committed to cushon/bazel by cushon 2 years ago
- Update temurin JDKs to 11.0.15 now that they're available Follow-up to https://github.com/bazelbuild/bazel/commit/8f3d99aa2e7c0742f7f89ddc3921350537feef77 ``` a8fba686f6eb8ae1d1a9566821dbd5a85a1108b... — committed to bazelbuild/bazel by cushon 2 years ago
- Remove javac jars This is the third_party part of https://github.com/bazelbuild/bazel/pull/15319 https://github.com/bazelbuild/bazel/issues/14533 Partial commit for third_party/*, see #15347. Sign... — committed to bazelbuild/bazel by cushon 2 years ago
@cushon Just wanted to follow up and thank you for all of your time and patience 😃
The 11.0.15 release of Java fixes everything for us (with the removal of --patch-module). Thank you!!!