bazelbuild / rules_jvm_external

Bazel rules to resolve, fetch and export Maven artifacts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Turbine Exception in 5.x versions

tferi opened this issue · comments

/external/rules_jvm_external/private/tools/java/com/github/bazelbuild/rules_jvm_external/BUILD:1:13: Compiling Java headers external/rules_jvm_external/private/tools/java/com/github/bazelbuild/rules_jvm_external/librules_jvm_external-hjar.jar (4 source files) [for tool] failed: (Exit 1): turbine_direct_graal failed: error executing command (from target @rules_jvm_external//private/tools/java/com/github/bazelbuild/rules_jvm_external:rules_jvm_external) external/remote_java_tools_darwin_arm64/java_tools/turbine_direct_graal --output ... (remaining 32 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
java.lang.NullPointerException: attempted to use --release, but JAVA_HOME is not set
        at java.base@20.0.2/java.util.Objects.requireNonNull(Objects.java:259)
        at com.google.turbine.binder.CtSymClassBinder.bind(CtSymClassBinder.java:55)
        at com.google.turbine.main.Main.bootclasspath(Main.java:309)
        at com.google.turbine.main.Main.compile(Main.java:142)
        at com.google.turbine.main.Main.compile(Main.java:133)
        at com.google.turbine.main.Main.main(Main.java:89)

This is present on all current 5.x versions (tested up to 5.3) on Bazel 6.4.0, Mac OS 13.5 (Darwin Kernel Version 22.6.0), remotejdk 17.

The error consistently does not occur on 4.5.

The error is misleading, as it is actually the java.home system property that's checked in the code, not the $JAVA_HOME environment variable, so it cannot be worked around with the (host_)?action_env flags.

Same for me.

same here

I'm only getting this issue when updating rules_java from 7.1.0 to 7.3.1.
With rules_java=7.1.0 I'm able to run rules_jvm_external=5.3.

On Bazel 6.4.0, using Bzlmod.

How do I replicate this issue? Within the repo, I've updated example/bzlmod/MODULE.bazel to use rules_java version 7.3.1, and I'm not seeing the problem.

For or-tools, just check out the main branch, and run bazel -c opt test ortools/...
It fails on my mac M1. I have bazel 6.4.0 homebrew.

I believe the issue is specifically with rules_java > 7.2.0 and Bazel < 7. See bazelbuild/rules_java#159

indeed, bazel7 works fine on a legacy WORKSPACE without bzlmod.
The issue is that brew has not updated past 6.4.0. I just switched to bazelisk.

Sorry for this. rules_java > 7.2.0 doesn't officially support Bazel 6. There shouldn't be a need to update past this version.

It appears this is an issue with Turbine, which is part of Bazel itself. In addition, the problem only occurs when using rules_java with a version of bazel it's not designed to be used with. Because of both of these things, I am closing this issue.