Skip to content

DumpPlatformClassPath.dumpJDK9AndNewerBootClassPath does not work with openjdk16 on OSX #13138

@eustas

Description

@eustas

Description of the problem / feature request:

bazel build fails with host openjdk16

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

.bazelrc:

build --define=ABSOLUTE_JAVABASE=/redacted/jdk-16.jdk/Contents/Home
build --javabase=@bazel_tools//tools/jdk:absolute_javabase
build --host_javabase=@bazel_tools//tools/jdk:absolute_javabase
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla

command: bazel build --sandbox_debug ...:all

result:

INFO: Analyzed 17 targets (0 packages loaded, 514 targets configured).
INFO: Found 17 targets...
ERROR: /private/var/tmp/_bazel_eustas/hhh/external/bazel_tools/tools/jdk/BUILD:346:14: Action external/bazel_tools/tools/jdk/platformclasspath.jar failed: (Exit 1): sandbox-exec failed: error executing command 
  (cd /private/var/tmp/_bazel_eustas/hhh/sandbox/darwin-sandbox/50/execroot/xxx_java && \
  exec env - \
    TMPDIR=/var/folders/f8/ttt/T/ \
  /usr/bin/sandbox-exec -f /private/var/tmp/_bazel_eustas/zzz/sandbox/darwin-sandbox/50/sandbox.sb /var/tmp/_bazel_eustas/install/hhh/process-wrapper '--timeout=0' '--kill_delay=15' /redacted/jdk-16.jdk/Contents/Home/bin/java -XX:+IgnoreUnrecognizedVMOptions '--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED' -cp bazel-out/darwin-fastbuild/bin/external/bazel_tools/tools/jdk/platformclasspath_classes:/redacted/jdk-16.jdk/Contents/Home/lib/tools.jar DumpPlatformClassPath bazel-out/darwin-fastbuild/bin/external/bazel_tools/tools/jdk/platformclasspath.jar /redacted/jdk-16.jdk/Contents/Home) sandbox-exec failed: error executing command 
  (cd /private/var/tmp/_bazel_eustas/hhh/sandbox/darwin-sandbox/50/execroot/xxx_java && \
  exec env - \
    TMPDIR=/var/folders/f8/ttt/T/ \
  /usr/bin/sandbox-exec -f /private/var/tmp/_bazel_eustas/hhh/sandbox/darwin-sandbox/50/sandbox.sb /var/tmp/_bazel_eustas/install/hhh/process-wrapper '--timeout=0' '--kill_delay=15' /redacted/jdk-16.jdk/Contents/Home/bin/java -XX:+IgnoreUnrecognizedVMOptions '--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED' -cp bazel-out/darwin-fastbuild/bin/external/bazel_tools/tools/jdk/platformclasspath_classes:/redacted/jdk-16.jdk/Contents/Home/lib/tools.jar DumpPlatformClassPath bazel-out/darwin-fastbuild/bin/external/bazel_tools/tools/jdk/platformclasspath.jar /redacted/jdk-16.jdk/Contents/Home)
Exception in thread "main" java.lang.IllegalAccessError: class DumpPlatformClassPath (in unnamed module @0x1b28cdfa) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x1b28cdfa
	at DumpPlatformClassPath.dumpJDK9AndNewerBootClassPath(DumpPlatformClassPath.java:104)
	at DumpPlatformClassPath.main(DumpPlatformClassPath.java:67)
INFO: Elapsed time: 0,383s, Critical Path: 0,16s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully

What operating system are you running Bazel on?

macOS Big Sur 11.2.2

What's the output of bazel info release?

release 4.0.0-homebrew

Have you found anything relevant by searching the web?

Likely, it works on other OS: https://stackoverflow.com/a/65161064

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

OpenJDK16 taken from here: https://jdk.java.net/16/
(https://download.java.net/java/GA/jdk16/7863447f0ab643c585b9bdebf67c69db/36/GPL/openjdk-16_osx-x64_bin.tar.gz)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)team-Rules-JavaIssues for Java rules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions