Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
davido opened this issue May 4, 2023 · 3 comments
Closed

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

davido opened this issue May 4, 2023 · 3 comments
Labels
team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug untriaged

Comments

@davido
Copy link
Contributor

davido commented May 4, 2023

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
@Pavank1992 Pavank1992 added type: bug untriaged team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website labels May 4, 2023
@davido
Copy link
Contributor Author

davido commented May 5, 2023

As pointed out by @fmeum on Slack, passing --java_language_version=20 fixed the build.

@fmeum
Copy link
Collaborator

fmeum commented May 7, 2023

Seems related to #17281. With my reproducer for that issue I can also reproduce this issue:

$ bazel build //:Main --tool_java_language_version=17 --tool_java_runtime_version=remotejdk_20
...
ERROR: .../external/bazel_tools/tools/java/runfiles/BUILD:17:12: Building external/bazel_tools/tools/java/runfiles/libauto_bazel_repository_processor.jar (1 source file) [for tool] failed: (Exit 1): java failed: error executing Javac command (from target @bazel_tools//tools/java/runfiles:auto_bazel_repository_processor) 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' ... (remaining 19 arguments skipped)
error: cannot access module-info
  bad class file: /modules/jdk.xml.dom/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.

@davido
Copy link
Contributor Author

davido commented May 7, 2023

@fmeum Thanks for the pointer.

This seems to be a duplicate of #17281. Let's close it and track the problem there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug untriaged
Projects
None yet
Development

No branches or pull requests

3 participants