Skip to content

Newer JDK support #18961

@jiapei100

Description

@jiapei100

Description of the feature request:

Trying to compile Bazel from Source without an existing Bazel binary.

With OpenJDK 19, I got an ERROR: Could not build Bazel.
But with an older version OpenJDK 11, it works fine.

What underlying problem are you trying to solve with this feature?

Support for newer version of OpenJDK

Which operating system are you running Bazel on?

Ubuntu 22.04

What is the output of bazel info release?

N/A

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

N/A, because I'm building Compiling Bazel from Source without an existing Bazel binary .

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

N/A

Have you found anything relevant by searching the web?

N/A

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

Error messages:

bazel-6.2.1-dist env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.sh
🍃  Building Bazel from scratch......
🍃  Building Bazel with Bazel.
.OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
DEBUG: /tmp/bazel_GJFf043H/out/external/build_bazel_rules_nodejs/index.bzl:122:10: WARNING: check_rules_nodejs_version has been removed. This is a no-op, please remove the call.
INFO: Analyzed target //src:bazel_nojdk (383 packages loaded, 10348 targets configured).
INFO: Found 1 target...
[0 / 224] 5 actions, 0 running
    [Prepa] BazelWorkspaceStatusAction stable-status.txt
    [Prepa] Writing file src/main/cpp/client-2.params
    [Prepa] Writing file src/embedded_tools_nojdk.params
    [Prepa] Writing file .../starlark/java/eval/libcpu_profiler.so-2.params
    [Prepa] Executing genrule //src:package_bazel_on_host_platform [for tool]
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.ExceptionInInitializerError
	at com.google.devtools.build.lib.actions.ParameterFile.writeContentLatin1(ParameterFile.java:141)
	at com.google.devtools.build.lib.actions.ParameterFile.writeContent(ParameterFile.java:120)
	at com.google.devtools.build.lib.actions.ParameterFile.writeParameterFile(ParameterFile.java:112)
	at com.google.devtools.build.lib.analysis.actions.ParameterFileWriteAction$ParamFileWriter.writeOutputFile(ParameterFileWriteAction.java:172)
	at com.google.devtools.build.lib.exec.FileWriteStrategy.beginWriteOutputToFile(FileWriteStrategy.java:58)
	at com.google.devtools.build.lib.analysis.actions.FileWriteActionContext.beginWriteOutputToFile(FileWriteActionContext.java:49)
	at com.google.devtools.build.lib.analysis.actions.AbstractFileWriteAction.beginExecution(AbstractFileWriteAction.java:66)
	at com.google.devtools.build.lib.actions.Action.execute(Action.java:133)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$5.execute(SkyframeActionExecutor.java:957)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.continueAction(SkyframeActionExecutor.java:1124)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.run(SkyframeActionExecutor.java:1082)
	at com.google.devtools.build.lib.skyframe.ActionExecutionState.runStateMachine(ActionExecutionState.java:160)
	at com.google.devtools.build.lib.skyframe.ActionExecutionState.getResultOrDependOnFuture(ActionExecutionState.java:93)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.executeAction(SkyframeActionExecutor.java:516)
	at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.checkCacheAndExecuteIfNeeded(ActionExecutionFunction.java:827)
	at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.computeInternal(ActionExecutionFunction.java:323)
	at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.compute(ActionExecutionFunction.java:161)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:571)
	at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:382)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make java.lang.String(byte[],byte) accessible: module java.base does not "opens java.lang" to unnamed module @228575c0
	at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:387)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:363)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:311)
	at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:192)
	at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:185)
	at com.google.devtools.build.lib.unsafe.StringUnsafe.<init>(StringUnsafe.java:61)
	at com.google.devtools.build.lib.unsafe.StringUnsafe.<clinit>(StringUnsafe.java:36)
	... 22 more

ERROR: Could not build Bazel

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions