bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.23k stars 4.07k forks source link

IllegalStateException: Undefined symbol in --incompatible_autoload_externally #24317

Open laurentlb opened 2 days ago

laurentlb commented 2 days ago

Description of the bug:

$ bazel build ... --incompatible_autoload_externally=rules_android
Starting local Bazel server and connecting to it...
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.IllegalStateException: Undefined symbol in --incompatible_autoload_externally
    at com.google.devtools.build.lib.packages.AutoloadSymbols.<init>(AutoloadSymbols.java:146)
    at com.google.devtools.build.lib.skyframe.SkyframeExecutor.preparePackageLoading(SkyframeExecutor.java:1499)
    at com.google.devtools.build.lib.skyframe.SkyframeExecutor.syncPackageLoading(SkyframeExecutor.java:2712)
    at com.google.devtools.build.lib.skyframe.SkyframeExecutor.sync(SkyframeExecutor.java:2667)
    at com.google.devtools.build.lib.skyframe.SequencedSkyframeExecutor.sync(SequencedSkyframeExecutor.java:282)
    at com.google.devtools.build.lib.runtime.CommandEnvironment.syncPackageLoading(CommandEnvironment.java:779)
    at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:585)
    at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:253)
    at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:608)
    at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:678)
    at io.grpc.Context$1.run(Context.java:566)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

Build label: 8.0.0rc2

If rules_android is not a valid value, a better error message was expected.

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.

No response

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

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 HEAD ?

No response

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

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

No response

laurentlb commented 2 days ago

It seems like I should use @rules_android above.

I got a slightly different crash here:

$ bazel build ... --incompatible_autoload_externally=ProguardSpecProvider                                     
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.IllegalStateException: Symbol in 'ProguardSpecProvider' can't be removed, because it's still used by: java_lite_proto_library, java_import
    at com.google.devtools.build.lib.packages.AutoloadSymbols.<init>(AutoloadSymbols.java:192)
    at com.google.devtools.build.lib.skyframe.SkyframeExecutor.preparePackageLoading(SkyframeExecutor.java:1499)
    at com.google.devtools.build.lib.skyframe.SkyframeExecutor.syncPackageLoading(SkyframeExecutor.java:2712)
    at com.google.devtools.build.lib.skyframe.SkyframeExecutor.sync(SkyframeExecutor.java:2667)
    at com.google.devtools.build.lib.skyframe.SequencedSkyframeExecutor.sync(SequencedSkyframeExecutor.java:282)
    at com.google.devtools.build.lib.runtime.CommandEnvironment.syncPackageLoading(CommandEnvironment.java:779)
    at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:585)
    at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:253)
    at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:608)
    at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:678)
    at io.grpc.Context$1.run(Context.java:566)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
iancha1992 commented 2 days ago

@laurentlb Could you please provide sample code to reproduce this issue?

laurentlb commented 2 days ago

It repros everywhere, even in an empty workspace.