bazelbuild / bazelbuild/rules_apple

xcframework creation fails with poor error for incorrect deps / headers

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

Description

With this BUILD file:

```bzl
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_static_xcframework")

apple_static_xcframework(
name = "foo",
ios = {
"simulator": ["x86_64"],
"device": ["arm64"],
},
minimum_os_versions = {"ios": "15.0"},
public_hdrs = ["no_header.h"],
deps = ["no_target"],
)
```

Where `no_target` and `no_header.h` don't exist, if you `bazel build foo` you get this error:

```
error: /Applications/Xcode-13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: no files specified
Usage: /Applications/Xcode-13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode-13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table ] [-seg_addr_table_filename ] [-all_load] [-noall_load]
Target //:foo failed to build
Use --verbose_failures to see the command lines of failed build steps.
```

Ideally this would error earlier in bazel since this makes it look like something went wrong with the build, not the configuration.

[xcfwrepro.zip](https://github.com/bazelbuild/rules_apple/files/8674086/xcfwrepro.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the BUILD file and xcfwrepro.zip, then run `bazel build foo` using the provided missing `no_target` dependency and `no_header.h` header. Trace the `apple_static_xcframework` validation path; done means Bazel reports the invalid dependencies or headers before invoking libtool.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
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.