Skip to content

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Oct 1, 2025

Add workflow to build packages for iOS on a macOS VM. Can't run tests at this time, but we can at least confirm source compiles.

@grynspan grynspan requested a review from a team as a code owner October 1, 2025 17:18
Add workflow to build packages for iOS on a macOS VM. Can't run tests at this
time, but we can at least confirm source compiles.
@grynspan grynspan force-pushed the jgrynspan/build-packages-for-ios branch from 5c049c8 to ae72e5b Compare October 1, 2025 21:03
ios_build_command:
type: string
description: "macOS command to build the package for iOS"
default: "xcrun swift build --build-tests --sdk \"$(xcrun --sdk iphoneos --show-sdk-path)\" --triple arm64-apple-ios"
Copy link

@kkebo kkebo Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, it would be better to use $(xcrun -f swift) instead of xcrun swift.

xcrun swift is fine with packages that do not contain executableTarget, but it causes the following errors with packages that contain executableTarget:

clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]

To prevent this, you can use $(xcrun -f swift) instead of xcrun swift.

Related discussion: https://forums.swift.org/t/getting-incompatible-sysroot-warning-when-compiling-for-ios-with-sdk-and-target-set/80584

You can easily reproduce this issue by the following steps:

mkdir foo && cd foo
swift package init --type executable --name Foo
xcrun swift build --sdk "$(xcrun --sdk iphoneos --show-sdk-path)" --triple arm64-apple-ios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants