Repository navigation
Conversation
With --arch plus -Xswiftc -target, the compiler is retargeted, but SwiftPM still resolves the package graph for the host triple (arm64-apple-macosx). That triple is what selects the slice of a binary target, so an iOS-only .xcframework such as GoogleMobileAds exposes no module and the dependent target fails with "no such module" (Brendonovich#74). --triple was only used under Xcode 27. Use it for every cross build, and look for the static library in the directory SwiftPM then creates (<arch>-apple-<os>[-simulator]/<configuration>). The Xcode 27 path is unchanged. Tested on Xcode 26.6: a package depending on GoogleMobileAds and GoogleUserMessagingPlatform builds for an iOS device, and the resulting app links and builds with xcodebuild. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #74.
Problem
Cross-compiling for iOS under Xcode < 27,
build.rsrunsswift build --arch arm64 -Xswiftc -sdk … -Xswiftc -target arm64-apple-ios…. The compiler is retargeted, but SwiftPM itself still resolves the package graph for the host triple (arm64-apple-macosx). That triple is what selects the slice of a binary target: an iOS-only.xcframework(GoogleMobileAds, for instance) has no macOS slice, its module is never exposed, and the dependent target fails with:--triplewas already the answer, but only under Xcode 27.Change
use_triple = cross_compilinginstead ofcross_compiling && xcode27.--tripleis used below Xcode 27, look forlib<name>.ain the directory SwiftPM then creates:<arch>-apple-<os>[-simulator]/<configuration>(e.g.arm64-apple-ios/release), instead of<arch>-apple-macosx/<configuration>.Tested
Xcode 26.6: a Swift package depending on
swift-package-manager-google-mobile-adsandswift-package-manager-google-user-messaging-platformnow builds for an iOS device, and the app that links it builds withxcodebuild(BUILD SUCCEEDED). Before the change, the same package failed with "no such module".TEST_SWIFT_RS=true cargo test --features build: all 6 tests intest_bindingspass, both with this change and onmainwithout it (my first run omittedTEST_SWIFT_RS, which crashes the binary before it links the test's own Swift code — unrelated to this change; corrected here).🤖 Generated with Claude Code