bazelbuild / bazelbuild/rules_apple

Require full Xcode installation, not only command line tools

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

Description

Failure:
```
ERROR: /private/var/tmp/_bazel_garymm/382171cfa5dea081b89290c512972b49/external/build_bazel_rules_swift_local_config/BUILD:9:22: in xcode_swift_toolchain rule @build_bazel_rules_swift_local_config//:toolchain:
Traceback (most recent call last):
File "/private/var/tmp/_bazel_garymm/382171cfa5dea081b89290c512972b49/external/build_bazel_rules_swift/swift/internal/xcode_swift_toolchain.bzl", line 566, column 29, in _xcode_swift_toolchain_impl
target_triples.parse(cc_toolchain.target_gnu_system_name),
File "/private/var/tmp/_bazel_garymm/382171cfa5dea081b89290c512972b49/external/build_bazel_rules_swift/swift/internal/target_triples.bzl", line 135, column 28, in _parse
vendor = components[1],
Error: index out of range (index is 1, but sequence has 1 elements)
```

Note I also tried `has_swift = False`, which surprisingly fails with:
`no such attribute 'has_swift' in 'apple_static_xcframework_import' rule`

WORKSPACE.bazel:
```python
http_archive(
name = "build_bazel_rules_apple",
sha256 = "90e3b5e8ff942be134e64a83499974203ea64797fd620eddeb71b3a8e1bff681",
url = "https://github.com/bazelbuild/rules_apple/releases/download/1.1.2/rules_apple.1.1.2.tar.gz",
)

load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)

apple_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)

swift_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)

swift_rules_extra_dependencies()

load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
)

apple_support_dependencies()

```

BUILD.bazel:
```python
load(
"@build_bazel_rules_apple//apple:apple.bzl",
"apple_static_xcframework_import",
)

apple_static_xcframework_import(
name = "libmoltenvk_dylib",
xcframework_imports = glob(["sdk/MoltenVK/MoltenVK.xcframework/**"]),
)
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure using the WORKSPACE.bazel and BUILD.bazel configurations shown, then inspect the referenced xcode_swift_toolchain.bzl and target_triples.bzl locations in the stack trace. The work is done when the reported configuration handles the Xcode installation requirement without the index-out-of-range failure and the unsupported has_swift attempt is clarified.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.