bazel: [Build failure] FreeBSD 14-CURRENT/Gentoo Linux amd64 with OpenJDK 17.0 and 18.0

Description of the bug:

Bazel release version 6.0.0 fails to build on FreeBSD 14-CURRENT amd64 with the following error:

Sun Jan 01 03:13 PM yesudeep at mongolia running bash5.2 on FreeBSD 14.0-CURRENT amd64
in ~/src/tmp6   master
>> env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" ./compile.sh
🍃  Building Bazel from scratch......
🍃  Building Bazel with Bazel.
.OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
DEBUG: /tmp/bazel_3aV1Io3I/out/external/build_bazel_rules_nodejs/index.bzl:122:10: WARNING: check_rules_nodejs_version has been removed. This is a no-op, please remove the call.
INFO: Analyzed target //src:bazel_nojdk (383 packages loaded, 10302 targets configured).
INFO: Found 1 target...
INFO: From Generating Descriptor Set proto_library @com_github_cncf_udpa//xds/service/orca/v3:pkg:
xds/service/orca/v3/orca.proto:14:1: warning: Import validate/validate.proto is unused.
INFO: From Compiling src/core/lib/security/transport/client_auth_filter.cc:
external/com_github_grpc_grpc/src/core/lib/security/transport/client_auth_filter.cc:153:8: warning: initialized lambda captures are a C++14 extension [-Wc++14-extensions]
      [call_args =
       ^
1 warning generated.
INFO: From Compiling src/core/ext/filters/fault_injection/fault_injection_filter.cc:
external/com_github_grpc_grpc/src/core/ext/filters/fault_injection/fault_injection_filter.cc:138:8: warning: initialized lambda captures are a C++14 extension [-Wc++14-extensions]
      [decision = std::move(decision)]() { return decision.MaybeAbort(); },
       ^
1 warning generated.
INFO: From Compiling src/core/ext/filters/channel_idle/channel_idle_filter.cc:
external/com_github_grpc_grpc/src/core/ext/filters/channel_idle/channel_idle_filter.cc:200:8: warning: initialized lambda captures are a C++14 extension [-Wc++14-extensions]
      [decrementer = Decrementer(this),
       ^
external/com_github_grpc_grpc/src/core/ext/filters/channel_idle/channel_idle_filter.cc:201:8: warning: initialized lambda captures are a C++14 extension [-Wc++14-extensions]
       next = next_promise_factory(std::move(call_args))]() mutable
       ^
2 warnings generated.
[1,294 / 1,313] [Prepa] @bazel_tools//third_party/ijar:zip
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.ExceptionInInitializerError
        at com.google.devtools.build.lib.actions.ParameterFile.writeContentLatin1(ParameterFile.java:141)
        at com.google.devtools.build.lib.actions.ParameterFile.writeContent(ParameterFile.java:120)
        at com.google.devtools.build.lib.actions.ParameterFile.writeParameterFile(ParameterFile.java:112)
        at com.google.devtools.build.lib.actions.CommandLines$ParamFileActionInput.writeTo(CommandLines.java:319)
        at com.google.devtools.build.lib.exec.local.LocalSpawnRunner$SubprocessHandler.start(LocalSpawnRunner.java:368)
        at com.google.devtools.build.lib.exec.local.LocalSpawnRunner$SubprocessHandler.runOnce(LocalSpawnRunner.java:258)
        at com.google.devtools.build.lib.exec.local.LocalSpawnRunner$SubprocessHandler.run(LocalSpawnRunner.java:229)
        at com.google.devtools.build.lib.exec.local.LocalSpawnRunner.exec(LocalSpawnRunner.java:170)
        at com.google.devtools.build.lib.exec.SpawnRunner.execAsync(SpawnRunner.java:299)
        at com.google.devtools.build.lib.exec.AbstractSpawnStrategy.exec(AbstractSpawnStrategy.java:152)
        at com.google.devtools.build.lib.exec.AbstractSpawnStrategy.exec(AbstractSpawnStrategy.java:112)
        at com.google.devtools.build.lib.actions.SpawnStrategy.beginExecution(SpawnStrategy.java:47)
        at com.google.devtools.build.lib.exec.SpawnStrategyResolver.beginExecution(SpawnStrategyResolver.java:64)
        at com.google.devtools.build.lib.analysis.actions.SpawnAction.beginExecution(SpawnAction.java:352)
        at com.google.devtools.build.lib.actions.Action.execute(Action.java:133)
        at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$5.execute(SkyframeActionExecutor.java:940)
        at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.continueAction(SkyframeActionExecutor.java:1107)
        at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.run(SkyframeActionExecutor.java:1065)
        at com.google.devtools.build.lib.skyframe.ActionExecutionState.runStateMachine(ActionExecutionState.java:160)
        at com.google.devtools.build.lib.skyframe.ActionExecutionState.getResultOrDependOnFuture(ActionExecutionState.java:93)
        at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.executeAction(SkyframeActionExecutor.java:507)
        at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.checkCacheAndExecuteIfNeeded(ActionExecutionFunction.java:826)
        at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.computeInternal(ActionExecutionFunction.java:323)
        at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.compute(ActionExecutionFunction.java:161)
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:571)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:382)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make java.lang.String(byte[],byte) accessible: module java.base does not "opens java.lang" to unnamed module @5b7d6536
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
        at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:191)
        at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:184)
        at com.google.devtools.build.lib.unsafe.StringUnsafe.<init>(StringUnsafe.java:61)
        at com.google.devtools.build.lib.unsafe.StringUnsafe.<clinit>(StringUnsafe.java:36)
        ... 29 more

ERROR: Could not build Bazel

System information:

>> uname -mrs
FreeBSD 14.0-CURRENT amd64

>> echo $JAVA_HOME
/usr/local/openjdk18

>> java --version
openjdk 18.0.2 2022-07-19
OpenJDK Runtime Environment (build 18.0.2+9-1)
OpenJDK 64-Bit Server VM (build 18.0.2+9-1, mixed mode, sharing)

>> java --version
openjdk 17.0.5 
OpenJDK Runtime Environment (build 18.0.2+9-1)
OpenJDK 64-Bit Server VM (build 18.0.2+9-1, mixed mode, sharing)

>> g++ --version
g++ (FreeBSD Ports Collection) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Release file used: https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-dist.zip

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

  1. Download https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-dist.zip
  2. Run unzip bazel-6.0.0-dist.zip
  3. Run env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" ./compile.sh

Which operating system are you running Bazel on?

FreeBSD 14-CURRENT amd64

What is the output of bazel info release?

release 5.3.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 ?

Not a git repository.

Have you found anything relevant by searching the web?

Possible related information:

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

No response

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 2
  • Comments: 19 (11 by maintainers)

Commits related to this issue

Most upvoted comments

As of today, version 6.2.0 has been included into Gentoo’s main tree! Thanks for the help!

Are there any major problems in using this approach?

No problem, but eventually we should also support newer JDK versions.