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

java.lang.RuntimeException when building for multiple archs an ios_application that depends on an apple_framework #902

Closed
vakhidbetrakhmadov opened this issue Aug 25, 2024 · 1 comment

Comments

@vakhidbetrakhmadov
Copy link
Contributor

vakhidbetrakhmadov commented Aug 25, 2024

Hi,

When building an ios_application from rules_apple that depends on an apple_framework, following error occures:

$ bazelisk build --apple_platform_type=ios --ios_multi_cpus=x86_64,sim_arm64 --//:test_case=apple_framework HelloWorldSwift
Analyzing: target //:HelloWorldSwift (90 packages loaded, 1135 targets configured)
    currently loading: @@build_bazel_rules_ios//rules/test_host_app
[1 / 1] checking cached actions
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'ConfiguredTargetKey{label=//:HelloWorldSwift, config=BuildConfigurationKey[38f23fb72e03f0a597d6c10cf5be599a95e3ea63a333be1217596f4f4081746c]}' (requested by nodes 'ConfiguredTargetKey{label=//:HelloWorldSwift, config=BuildConfigurationKey[2e520ce0ae79be1571c07d6987a022b56061727d1a2cc69b5284af9c1a3729b9]}')
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:550)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:414)
        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: IllegalStateException thrown during Starlark evaluation (//:HelloWorldSwift)
        at <starlark>.link_multi_arch_binary(<builtin>:0)
        at <starlark>._register_binary_linking_action(/private/var/tmp/_bazel_vakhid.betrakhmadov/683f29226f77b774d9de4d50b9c730af/external/build_bazel_rules_apple/apple/internal/linking_support.bzl:243)
        at <starlark>._ios_application_impl(/private/var/tmp/_bazel_vakhid.betrakhmadov/683f29226f77b774d9de4d50b9c730af/external/build_bazel_rules_apple/apple/internal/ios_rules.bzl:241)
Caused by: java.lang.IllegalStateException: Split transition keys are different between 'deps' [[Optional.of(ios_x86_64)]] and '$child_configuration_dummy' [[Optional.of(ios_sim_arm64), Optional.of(ios_x86_64)]]
        at com.google.common.base.Preconditions.checkState(Preconditions.java:854)
        at com.google.devtools.build.lib.rules.objc.AppleBinary.linkMultiArchBinary(AppleBinary.java:82)
        at com.google.devtools.build.lib.rules.objc.AppleStarlarkCommon.linkMultiArchBinary(AppleStarlarkCommon.java:311)
        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:806)
        at net.starlark.java.eval.Eval.evalCall(Eval.java:682)
        at net.starlark.java.eval.Eval.eval(Eval.java:497)
        at net.starlark.java.eval.Eval.execAssignment(Eval.java:109)
        at net.starlark.java.eval.Eval.exec(Eval.java:268)
        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:179)
        at net.starlark.java.eval.Starlark.fastcall(Starlark.java:806)
        at net.starlark.java.eval.Eval.evalCall(Eval.java:682)
        at net.starlark.java.eval.Eval.eval(Eval.java:497)
        at net.starlark.java.eval.Eval.execAssignment(Eval.java:109)
        at net.starlark.java.eval.Eval.exec(Eval.java:268)
        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:179)
        at net.starlark.java.eval.Starlark.fastcall(Starlark.java:806)
        at com.google.devtools.build.lib.analysis.starlark.StarlarkRuleConfiguredTargetUtil.evalRule(StarlarkRuleConfiguredTargetUtil.java:100)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:376)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:194)
        at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:1308)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:385)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:312)
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:461)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:414)
        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)

I have created a minimal repro example that can be found here: https://github.com/vakhidbetrakhmadov/ios_multi_cpus_repro.

To reproduce the error above, please run bazelisk build --apple_platform_type=ios --ios_multi_cpus=x86_64,sim_arm64 --//:test_case=apple_framework HelloWorldSwift.

As a comparison, when apple_framework is replaced with swift_library, it compiles just fine.

To observe that, please run bazelisk build --apple_platform_type=ios --ios_multi_cpus=x86_64,sim_arm64 --//:test_case=swift_library HelloWorldSwift.

Same is true when compiling for a single arch.

To observe that, please run bazelisk build --apple_platform_type=ios --ios_multi_cpus=x86_64 --//:test_case=apple_framework HelloWorldSwift or bazelisk build --apple_platform_type=ios --ios_multi_cpus=sim_arm64 --//:test_case=apple_framework HelloWorldSwift.

@vakhidbetrakhmadov vakhidbetrakhmadov changed the title java.lang.RuntimeException when building ios_application that depends on apple_framework for multiple archs java.lang.RuntimeException when building for multiple archs and ios_application that depends on apple_framework Aug 25, 2024
@vakhidbetrakhmadov vakhidbetrakhmadov changed the title java.lang.RuntimeException when building for multiple archs and ios_application that depends on apple_framework java.lang.RuntimeException when building for multiple archs an ios_application that depends on apple_framework Aug 25, 2024
@vakhidbetrakhmadov vakhidbetrakhmadov changed the title java.lang.RuntimeException when building for multiple archs an ios_application that depends on apple_framework java.lang.RuntimeException when building for multiple archs an ios_application that depends on an apple_framework Aug 25, 2024
@jszumski
Copy link
Collaborator

I'm going to close this in favor of bazelbuild/rules_apple#2518, thanks for investigating the issue though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants