Skip to content

Cannot build any more after update of rules_java to 7.3.0 #20298

@davido

Description

@davido

Description of the bug:

Trying to build Bazel@HEAD (6d0716d) after #20216 is failing with:

$> bazel build -s src:bazel-bin-dev
[...]
SUBCOMMAND: # @rules_jvm_external~5.2//private/tools/java/com/github/bazelbuild/rules_jvm_external/zip:zip [action 'Compiling Java headers external/rules_jvm_external~5.2/private/tools/java/com/github/bazelbuild/rules_jvm_external/zip/libzip-hjar.jar (1 source file) [for tool]', configuration: 068f53a2413fd0ad955d2d18c7d44f82f04beb3900c10e221b299e686a717fe8, execution platform: //:default_host_platform]
(cd /home/davido/.cache/bazel/_bazel_davido/0fa756dec521553dbe2dde6b6eac99b4/execroot/_main && \
  exec env - \
    LC_CTYPE=en_US.UTF-8 \
    PATH=/home/davido/.cache/bazelisk/downloads/bazelbuild/bazel-6.4.0-linux-x86_64/bin:/home/davido/.yarn/bin:/home/davido/.config/yarn/global/node_modules/.bin:/home/davido/pgm/apache-maven-3.8.6/bin:/home/davido/bin:/home/davido/.yarn/bin:/home/davido/.config/yarn/global/node_modules/.bin:/home/davido/pgm/google-cloud-sdk/bin:/home/davido/pgm/apache-maven-3.8.6/bin:/home/davido/bin:/home/davido/bin:/usr/local/bin:/usr/bin:/bin \
  external/rules_java~7.3.0~toolchains~remote_java_tools_linux/java_tools/turbine_direct_graal --output bazel-out/k8-opt-exec-EDC14992/bin/external/rules_jvm_external~5.2/private/tools/java/com/github/bazelbuild/rules_jvm_external/zip/libzip-hjar.jar --output_deps bazel-out/k8-opt-exec-EDC14992/bin/external/rules_jvm_external~5.2/private/tools/java/com/github/bazelbuild/rules_jvm_external/zip/libzip-hjar.jdeps --bootclasspath bazel-out/k8-opt-exec-EDC14992/bin/external/rules_java~7.3.0/toolchains/platformclasspath.jar --sources external/rules_jvm_external~5.2/private/tools/java/com/github/bazelbuild/rules_jvm_external/zip/StableZipEntry.java --javacopts -source 11 -target 11 '-XDskipDuplicateBridges=true' '-XDcompilePolicy=simple' -g -parameters -Xep:ReturnValueIgnored:OFF -Xep:IgnoredPureGetter:OFF -Xep:EmptyTopLevelDeclaration:OFF -Xep:LenientFormatStringValidation:OFF -Xep:ReturnMissingNullable:OFF -Xep:UseCorrectAssertInTests:OFF -- --target_label @@rules_jvm_external~5.2//private/tools/java/com/github/bazelbuild/rules_jvm_external/zip:zip --reduce_classpath_mode NONE)
# Configuration: 068f53a2413fd0ad955d2d18c7d44f82f04beb3900c10e221b299e686a717fe8
# Execution platform: //:default_host_platform
ERROR: /home/davido/.cache/bazel/_bazel_davido/0fa756dec521553dbe2dde6b6eac99b4/external/rules_jvm_external~5.2/private/tools/java/com/github/bazelbuild/rules_jvm_external/zip/BUILD:1:13: Compiling Java headers external/rules_jvm_external~5.2/private/tools/java/com/github/bazelbuild/rules_jvm_external/zip/libzip-hjar.jar (1 source file) [for tool] failed: (Exit 1): turbine_direct_graal failed: error executing command (from target @rules_jvm_external~5.2//private/tools/java/com/github/bazelbuild/rules_jvm_external/zip:zip) external/rules_java~7.3.0~toolchains~remote_java_tools_linux/java_tools/turbine_direct_graal --output ... (remaining 27 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
The current machine does not support all of the following CPU features that are required by the image: [CX8, CMOV, FXSR, MMX, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, POPCNT, LZCNT, AVX, AVX2, BMI1, BMI2, FMA].
Please rebuild the executable with an appropriate setting of the -march option.Target //src:bazel-bin-dev failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/davido/.cache/bazel/_bazel_davido/0fa756dec521553dbe2dde6b6eac99b4/external/rules_jvm_external~5.2/private/tools/java/com/github/bazelbuild/rules_jvm_external/jar/BUILD:3:12 Building external/rules_jvm_external~5.2/private/tools/java/com/github/bazelbuild/rules_jvm_external/jar/AddJarManifestEntry.jar (1 source file) [for tool] failed: (Exit 1): turbine_direct_graal failed: error executing command (from target @rules_jvm_external~5.2//private/tools/java/com/github/bazelbuild/rules_jvm_external/zip:zip) external/rules_java~7.3.0~toolchains~remote_java_tools_linux/java_tools/turbine_direct_graal --output ... (remaining 27 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
INFO: Elapsed time: 133.701s, Critical Path: 81.07s
INFO: 625 processes: 170 internal, 455 linux-sandbox.
FAILED: Build did NOT complete successfully

Which category does this issue belong to?

No response

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

Have a 7 year old Lenovo Thinkpad Laptop with latest Linux version installed:

$ uname -a
Linux localhost 6.5.9-1-default #1 SMP PREEMPT_DYNAMIC Wed Oct 25 10:31:37 UTC 2023 (29edc7c) x86_64 x86_64 x86_64 GNU/Linux

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

6.4.0

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

No response

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

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

#20216

Have you found anything relevant by searching the web?

As pointed out in this SO thread, detecting my cpu support for x86-64-v2:

$ g++ multiversioning.c 

$ ./a.out 
x86-64-v2

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

According to the Graal VM native image build documentation, -march option defaults to x86-64-v3 on AMD64.

Workaround is to revert the recent rule_javaupgrade:

diff --git a/MODULE.bazel b/MODULE.bazel
index e925eed382..d1e114d682 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -23,7 +23,7 @@ bazel_dep(name = "zstd-jni", version = "1.5.2-3.bcr.1")
 bazel_dep(name = "blake3", version = "1.3.3.bcr.1")
 bazel_dep(name = "zlib", version = "1.3")
 bazel_dep(name = "rules_cc", version = "0.0.9")
-bazel_dep(name = "rules_java", version = "7.3.0")
+bazel_dep(name = "rules_java", version = "7.2.0")
 bazel_dep(name = "rules_graalvm", version = "0.10.3")
 bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
 bazel_dep(name = "rules_jvm_external", version = "5.2")

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