bazelbuild / bazelbuild/rules_apple
Bug: When Static XCFramework depends on objc_library importing XCFramework fails to build
- Dominant language
- Starlark
- Stars
- 593
- Forks
- 334
- Avg merge
- 16h 48m
- Merged PRs (30d)
- 9
Description
### What's the issue
I have a static xcframework which is consumed using rule `apple_static_xcframework_import` and this xcfraemwork depends on an `objc_library`. Importing this XCFramework inside swift classes of `ios_application` fails to build with following error
```
/private/var/tmp/_bazel_sanju/e107e611dd65132537122ef1dabd8e89/execroot/__main__/TimeManager/TImeManager.xcframework/ios-arm64_x86_64-simulator/TImeManager.framework/Modules/TImeManager.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface:6:8: error: no such module 'GCDTimeManager'
import GCDTimeManager
^
BazelDemo/ViewController.swift:9:8: error: failed to build module 'TImeManager'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)', while this compiler is 'Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)'). Please select a toolchain which matches the SDK.
import TImeManager
```
### How to reproduce
Clone this repository - https://github.com/sanju-naik/Bazel-Example and checkout `xcframework-error` branch .
then running this command `bazel build --config=Debug --ios_multi_cpus=sim_arm64 --verbose_failures BazelDemo` throws the error.
Contributor guide
Research direction
Clone the linked Bazel-Example repository, check out the xcframework-error branch, and run the provided bazel build command with verbose failures. Start by examining apple_static_xcframework_import and its objc_library dependency handling for the missing GCDTimeManager module. Done means the BazelDemo build succeeds without the reported Swift module error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c, swift
- Domain
- build-system, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 34/100