bazelbuild / bazelbuild/rules_apple

Error: key "darwin_arm64_device" not found in dictionary when trying to build apple_xcframework

Open
#1,838 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
593
Forks
334
Avg merge
16h 48m
Merged PRs (30d)
9

Description

I'm trying to build an apple_xcframework from a swift_library target. The swift_library target already builds fine and I can use it in an ios_application without issue.

The xcframework is defined like this:
```
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_xcframework")

apple_xcframework(
name = "ViewFoundationUIFramework",
bundle_id = "com.LoganShire.ViewFoundationUIFramework",
families_required = {
"ios": [
"iphone",
"ipad",
],
},
infoplists = [":Info.plist"],
minimum_os_versions = {
"ios" : "14.0",
},
visibility = ["//visibility:public"],
deps = [
":ViewFoundationUI",
],
)
```
Where ViewFoundationUI is the swift_library.

I'm trying to build it with:
```
bazel build //Libraries/FoundationUI/ViewFoundationUI:ViewFoundationUIFramework
```

Which yields the following error:
```
logan@Logans-MBP Snag % bazel build //Libraries/FoundationUI/ViewFoundationUI:ViewFoundationUIFramework
INFO: Build options --apple_platform_type and --ios_multi_cpus have changed, discarding analysis cache.
ERROR: /Users/logan/Developer/Swift/Apps/Snag/Libraries/FoundationUI/ViewFoundationUI/BUILD:18:18: in apple_xcframework rule //Libraries/FoundationUI/ViewFoundationUI:ViewFoundationUIFramework:
Traceback (most recent call last):
File "/private/var/tmp/_bazel_logan/9c5dc880d421e060978209038345ac60/external/build_bazel_rules_apple/apple/internal/xcframework_rules.bzl", line 506, column 83, in _apple_xcframework_impl
link_outputs_by_library_identifier = _group_link_outputs_by_library_identifier(
File "/private/var/tmp/_bazel_logan/9c5dc880d421e060978209038345ac60/external/build_bazel_rules_apple/apple/internal/xcframework_rules.bzl", line 194, column 45, in _group_link_outputs_by_library_identifier
if swift_support.uses_swift(deps[split_attr_key]):
Error: key "darwin_arm64_device" not found in dictionary
ERROR: /Users/logan/Developer/Swift/Apps/Snag/Libraries/FoundationUI/ViewFoundationUI/BUILD:18:18: Analysis of target '//Libraries/FoundationUI/ViewFoundationUI:ViewFoundationUIFramework' failed
ERROR: Analysis of target '//Libraries/FoundationUI/ViewFoundationUI:ViewFoundationUIFramework' failed; build aborted:
INFO: Elapsed time: 0.188s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 1495 targets configured)
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the shown bazel build command and inspect external/build_bazel_rules_apple/apple/internal/xcframework_rules.bzl at lines 194 and 506, along with the BUILD definition. Trace why the swift_library dependency lacks the darwin_arm64_device key during apple_xcframework analysis. Done means the reported target analyzes and builds successfully without this dictionary error.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.