bazelbuild / bazelbuild/rules_apple

Can `build --enable_platform_specific_config` automatically detect the right APPLE_SDK_PLATFORM for build target?

Open
#2,501 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

Hi,

When we upgrade Bazel from 6.x to 7.x, it seems that the flag `build --apple_platform_type=ios` no longer works.
We expect to use the below config in .bazelrc, to detect the targets automatically. If the build target is `ios_arm64`, it will include all ios standard libraries. If the build target is "macos_arm64", it will include all macOS libraries.
```
build --enable_platform_specific_config
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
build:macos --crosstool_top=@local_config_apple_cc//:toolchain
build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain
```

However, likely it doesn't work that way. when we try to build an iOS build target, it still misses some standard ios libraries. for instance,

fatal error: 'UIKit/UIKit.h' file not found
#import
^~~~~~~~~~~~~~~
1 error generated.
Error in child process '/usr/bin/xcrun'. 1

Contributor guide

Open the contributing guide

Research direction

Start with the .bazelrc configuration using --enable_platform_specific_config and the platform-specific crosstool settings. Reproduce the ios_arm64 build and inspect the xcrun failure and missing UIKit/UIKit.h diagnostic, then compare it with a macos_arm64 build. Done means the selected target automatically receives the appropriate Apple SDK and the iOS standard libraries are found.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.