Skip to content

Fedora 39/JDK20: class file has wrong version 64.0, should be 61.0 #18309

@davido

Description

@davido

I'm trying to build Bazel on Fedora 39, using this Dockerfile:

FROM fedora:39
  
RUN dnf install -y \
  findutils \
  g++ \
  gcc \
  gdb \
  git-core \
  java-latest-openjdk \
  java-latest-openjdk-devel \
  patch \
  perl \
  python \
  python3 \
  unzip \
  vim \
  wget \
  which \
  zip \
  && dnf clean all \
  && rm -rf /var/cache/yum

RUN wget -O /tmp/bazel.sh https://github.com/bazelbuild/bazel/releases/download/7.0.0-pre.20230426.1/bazel-7.0.0-pre.20230426.1-installer-linux-x86_64.sh

RUN bash /tmp/bazel.sh
RUN rm -rf /tmp/bazel.sh

After building and running this docker image, I clone Bazel@HEAD, remove .bazelversion file, and run:

  $ bazel build --verbose_failures -s src:bazel-bin-dev
[...]
SUBCOMMAND: # @maven//:com_google_auto_value_auto_value_annotations [action 'Stamping the manifest of @maven//:com_google_auto_value_auto_value_annotations', configuration: b8a7b5cf2e3e0c73ef26d3eb2b48836d09f2a7ab09b29ece7b0d44b318d47047, execution platform: //:default_host_platform, mnemonic: k8-fastbuild]
(cd /root/.cache/bazel/_bazel_root/c3f693c9ee156a44cfde6b8dd8889e98/execroot/io_bazel && \
  exec env - \
  bazel-out/k8-opt-exec-ST-a8e4410a6b56/bin/external/rules_jvm_external/private/tools/java/rules/jvm/external/jar/AddJarManifestEntry --source bazel-out/k8-fastbuild/bin/external/maven/v1/https/repo1.maven.org/maven2/com/google/auto/value/auto-value-annotations/1.9/auto-value-annotations-1.9.jar --output bazel-out/k8-fastbuild/bin/external/maven/v1/https/repo1.maven.org/maven2/com/google/auto/value/auto-value-annotations/1.9/processed_auto-value-annotations-1.9.jar --manifest-entry Target-Label:@maven//:com_google_auto_value_auto_value_annotations)
# Configuration: b8a7b5cf2e3e0c73ef26d3eb2b48836d09f2a7ab09b29ece7b0d44b318d47047
# Execution platform: //:default_host_platform
ERROR: /projects/bazel/src/main/java/com/google/devtools/build/lib/util/BUILD:55:13: Building src/main/java/com/google/devtools/build/lib/util/libsingle_line_formatter.jar (1 source file) failed: (Exit 1): java failed: error executing command (from target //src/main/java/com/google/devtools/build/lib/util:single_line_formatter) 
  (cd /root/.cache/bazel/_bazel_root/c3f693c9ee156a44cfde6b8dd8889e98/execroot/io_bazel && \
  exec env - \
    LC_CTYPE=en_US.UTF-8 \
    PATH=/root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
  external/remotejdk17_linux/bin/java '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.resources=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED' '--add-opens=java.base/java.nio=ALL-UNNAMED' '--add-opens=java.base/java.lang=ALL-UNNAMED' '-Dsun.io.useCanonCaches=false' -XX:-CompactStrings -Xlog:disable '-Xlog:all=warning:stderr:uptime,level,tags' -jar external/remote_java_tools/java_tools/JavaBuilder_deploy.jar @bazel-out/k8-fastbuild/bin/src/main/java/com/google/devtools/build/lib/util/libsingle_line_formatter.jar-0.params @bazel-out/k8-fastbuild/bin/src/main/java/com/google/devtools/build/lib/util/libsingle_line_formatter.jar-1.params)
# Configuration: b8a7b5cf2e3e0c73ef26d3eb2b48836d09f2a7ab09b29ece7b0d44b318d47047
# Execution platform: //:default_host_platform
error: cannot access module-info
  bad class file: /modules/jdk.net/module-info.class
    class file has wrong version 64.0, should be 61.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.
error: cannot access module-info
  bad class file: /modules/jdk.accessibility/module-info.class
    class file has wrong version 64.0, should be 61.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.
error: cannot access module-info
  bad class file: /modules/jdk.internal.vm.compiler.management/module-info.class
    class file has wrong version 64.0, should be 61.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.

Environment:

  $ java -fullversion
openjdk full version "20.0.1+9"

  $ g++ --version
g++ (GCC) 13.1.1 20230426 (Red Hat 13.1.1-1)

  $ bazel version
build label: 7.0.0-pre.20230420.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    team-OSSIssues for the Bazel OSS team: installation, release processBazel packaging, websitetype: buguntriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions