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

Bazel 8 crash when building ios_application at the root #24625

Closed
jpsim opened this issue Dec 10, 2024 · 7 comments
Closed

Bazel 8 crash when building ios_application at the root #24625

jpsim opened this issue Dec 10, 2024 · 7 comments
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts team-Rules-ObjC Issues for Objective-C maintainers type: bug

Comments

@jpsim
Copy link

jpsim commented Dec 10, 2024

Description of the bug:

When building an iOS app using Bazel 8.0.0 and rules_apple 3.16.0, Bazel crashes with the following output:

$ bazel build //:iOSApp
Analyzing: target //:iOSApp (28 packages loaded, 553 targets configured)
    currently loading: @@rules_python+//python/private

FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'ConfiguredTargetKey{label=//:iOSApp, config=BuildConfigurationKey[8eddf44734490dc07f46b246d49780b061f129833bf45d4750c99942b5c6ace7]}' (requested by nodes 'ConfiguredTargetKey{label=//:iOSApp, config=BuildConfigurationKey[e5d0b45255bbe29fcc274b3efed42ccbd4b88bf8d5a015d3138aed480339a787]}')
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:547)
	at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:435)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: net.starlark.java.eval.Starlark$UncheckedEvalException: IllegalArgumentException thrown during Starlark evaluation (//:iOSApp)
	at <starlark>.declare_shareable_artifact(<builtin>:0)
	at <starlark>._register_configuration_specific_link_actions(/virtual_builtins_bzl/common/objc/compilation_support.bzl:858)
	at <starlark>._link_multi_arch_binary(/private/var/tmp/_bazel_jsimard/91c5c0ba17ff5874fc856288746ea05f/external/rules_apple+/apple/internal/linking_support.bzl:300)
	at <starlark>._register_binary_linking_action(/private/var/tmp/_bazel_jsimard/91c5c0ba17ff5874fc856288746ea05f/external/rules_apple+/apple/internal/linking_support.bzl:528)
	at <starlark>._ios_application_impl(/private/var/tmp/_bazel_jsimard/91c5c0ba17ff5874fc856288746ea05f/external/rules_apple+/apple/internal/ios_rules.bzl:239)
Caused by: java.lang.IllegalArgumentException: /iOSApp_bin
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
	at com.google.devtools.build.lib.actions.ArtifactFactory.validatePath(ArtifactFactory.java:183)
	at com.google.devtools.build.lib.actions.ArtifactFactory.getDerivedArtifact(ArtifactFactory.java:227)
	at com.google.devtools.build.lib.analysis.CachingAnalysisEnvironment.getDerivedArtifact(CachingAnalysisEnvironment.java:282)
	at com.google.devtools.build.lib.analysis.CachingAnalysisEnvironment.getDerivedArtifact(CachingAnalysisEnvironment.java:274)
	at com.google.devtools.build.lib.analysis.RuleContext.getShareableArtifact(RuleContext.java:716)
	at com.google.devtools.build.lib.analysis.starlark.StarlarkActionFactory.createShareableArtifact(StarlarkActionFactory.java:1023)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at net.starlark.java.eval.MethodDescriptor.call(MethodDescriptor.java:178)
	at net.starlark.java.eval.BuiltinFunction.fastcall(BuiltinFunction.java:78)
	at net.starlark.java.eval.Starlark.fastcall(Starlark.java:807)
	at net.starlark.java.eval.Eval.evalCall(Eval.java:699)
	at net.starlark.java.eval.Eval.eval(Eval.java:514)
	at net.starlark.java.eval.Eval.execAssignment(Eval.java:121)
	at net.starlark.java.eval.Eval.exec(Eval.java:285)
	at net.starlark.java.eval.Eval.execStatements(Eval.java:82)
	at net.starlark.java.eval.Eval.execIf(Eval.java:224)
	at net.starlark.java.eval.Eval.exec(Eval.java:300)
	at net.starlark.java.eval.Eval.execStatements(Eval.java:82)
	at net.starlark.java.eval.Eval.execFunctionBody(Eval.java:66)
	at net.starlark.java.eval.StarlarkFunction.fastcall(StarlarkFunction.java:208)
	at net.starlark.java.eval.Starlark.fastcall(Starlark.java:807)
	at net.starlark.java.eval.Eval.evalCall(Eval.java:699)
	at net.starlark.java.eval.Eval.eval(Eval.java:514)
	at net.starlark.java.eval.Eval.execAssignment(Eval.java:121)
	at net.starlark.java.eval.Eval.exec(Eval.java:285)
	at net.starlark.java.eval.Eval.execStatements(Eval.java:82)
	at net.starlark.java.eval.Eval.execFor(Eval.java:138)
	at net.starlark.java.eval.Eval.exec(Eval.java:293)
	at net.starlark.java.eval.Eval.execStatements(Eval.java:82)
	at net.starlark.java.eval.Eval.execFunctionBody(Eval.java:66)
	at net.starlark.java.eval.StarlarkFunction.fastcall(StarlarkFunction.java:208)
	at net.starlark.java.eval.Starlark.fastcall(Starlark.java:807)
	at net.starlark.java.eval.Eval.evalCall(Eval.java:699)
	at net.starlark.java.eval.Eval.eval(Eval.java:514)
	at net.starlark.java.eval.Eval.execAssignment(Eval.java:121)
	at net.starlark.java.eval.Eval.exec(Eval.java:285)
	at net.starlark.java.eval.Eval.execStatements(Eval.java:82)
	at net.starlark.java.eval.Eval.execFunctionBody(Eval.java:66)
	at net.starlark.java.eval.StarlarkFunction.fastcall(StarlarkFunction.java:208)
	at net.starlark.java.eval.Starlark.fastcall(Starlark.java:807)
	at net.starlark.java.eval.Eval.evalCall(Eval.java:699)
	at net.starlark.java.eval.Eval.eval(Eval.java:514)
	at net.starlark.java.eval.Eval.execAssignment(Eval.java:121)
	at net.starlark.java.eval.Eval.exec(Eval.java:285)
	at net.starlark.java.eval.Eval.execStatements(Eval.java:82)
	at net.starlark.java.eval.Eval.execFunctionBody(Eval.java:66)
	at net.starlark.java.eval.StarlarkFunction.fastcall(StarlarkFunction.java:208)
	at net.starlark.java.eval.Starlark.fastcall(Starlark.java:807)
	at com.google.devtools.build.lib.analysis.starlark.StarlarkRuleConfiguredTargetUtil.evalRule(StarlarkRuleConfiguredTargetUtil.java:100)
	at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:405)
	at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:202)
	at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:1389)
	at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:447)
	at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:371)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:467)
	at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:435)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)

Following the main rules_apple tutorial in doc/tutorials/ios-app.md is enough to reproduce the issue.

I also found that if the ios_application is not at the root then this crash doesn't occur: e.g. //foo:iOSApp

Also using Bazel 7.4.1 works fine. 8.0.0rc1 also crashes in the same way.

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.

Following the main rules_apple tutorial in doc/tutorials/ios-app.md is enough to reproduce the issue.

Which operating system are you running Bazel on?

macOS 15.1.1 (24B2091)

What is the output of bazel info release?

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

Originally reported here: bazelbuild/rules_apple#2619

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

No response

@keith
Copy link
Member

keith commented Dec 10, 2024

cc @pzembrod guess this is a bug in the newly used declare_shareable_artifact bits

@iancha1992 iancha1992 added the team-Remote-Exec Issues and PRs for the Execution (Remote) team label Dec 10, 2024
@meteorcloudy meteorcloudy added team-Rules-ObjC Issues for Objective-C maintainers team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts and removed team-Remote-Exec Issues and PRs for the Execution (Remote) team labels Dec 11, 2024
@meteorcloudy
Copy link
Member

@bazel-io fork 8.0.1

@pzembrod
Copy link
Contributor

Yeah, just looked at #24625 - thanks for your comment there

@pzembrod pzembrod added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Dec 12, 2024
@pzembrod
Copy link
Contributor

Definitely something we should fix for 8.0.1.

@keith
Copy link
Member

keith commented Dec 14, 2024

#24698

keith added a commit to keith/bazel that referenced this issue Dec 14, 2024
bazel-io pushed a commit to bazel-io/bazel that referenced this issue Dec 17, 2024
Fixes bazelbuild#24625

Closes bazelbuild#24698.

PiperOrigin-RevId: 707183228
Change-Id: I369a37e8e652545274ec4949b1c3ac1d2fab38cb
bazel-io pushed a commit to bazel-io/bazel that referenced this issue Dec 17, 2024
Fixes bazelbuild#24625

Closes bazelbuild#24698.

PiperOrigin-RevId: 707183228
Change-Id: I369a37e8e652545274ec4949b1c3ac1d2fab38cb
github-merge-queue bot pushed a commit that referenced this issue Dec 18, 2024
Fixes #24625

Closes #24698.

PiperOrigin-RevId: 707183228
Change-Id: I369a37e8e652545274ec4949b1c3ac1d2fab38cb

Commit
2864f2a

Co-authored-by: Keith Smiley <[email protected]>
github-merge-queue bot pushed a commit that referenced this issue Dec 18, 2024
Fixes #24625

Closes #24698.

PiperOrigin-RevId: 707183228
Change-Id: I369a37e8e652545274ec4949b1c3ac1d2fab38cb

Commit
2864f2a

Co-authored-by: Keith Smiley <[email protected]>
iancha1992 pushed a commit that referenced this issue Dec 19, 2024
Fixes #24625

Closes #24698.

PiperOrigin-RevId: 707183228
Change-Id: I369a37e8e652545274ec4949b1c3ac1d2fab38cb
@iancha1992
Copy link
Member

A fix for this issue has been included in Bazel 8.0.1 RC1. Please test out the release candidate and report any issues as soon as possible.
If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=8.0.1rc1. Thanks!

@jpsim
Copy link
Author

jpsim commented Jan 17, 2025

Fix works well, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts team-Rules-ObjC Issues for Objective-C maintainers type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants