From 35a4e169191667f0ca0667fce1787b8667c3d6c6 Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Fri, 24 Oct 2025 00:32:46 +0900 Subject: [PATCH] Fix build warnings in the workflow for iOS IMHO, it would be better to use `$(xcrun -f swift)` ("find" mode) instead of `xcrun swift` ("run" mode). `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, we 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 --- .github/workflows/pull_request.yml | 2 +- .github/workflows/swift_package_test.yml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 6870f2a..31e87fb 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -90,7 +90,7 @@ jobs: enable_ios_checks: true ios_pre_build_command: | pwd - xcrun swift package init --type library + "$(xcrun -f swift)" package init --type library soundness: name: Soundness diff --git a/.github/workflows/swift_package_test.yml b/.github/workflows/swift_package_test.yml index 4e1925a..c20daf5 100644 --- a/.github/workflows/swift_package_test.yml +++ b/.github/workflows/swift_package_test.yml @@ -110,7 +110,7 @@ on: 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" + default: "\"$(xcrun -f swift)\" build --build-tests --sdk \"$(xcrun --sdk iphoneos --show-sdk-path)\" --triple arm64-apple-ios" linux_build_command: type: string description: "Linux command to build and test the package" @@ -255,7 +255,8 @@ jobs: - name: Select Xcode run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app" >> $GITHUB_ENV - name: Swift version - run: xcrun swift --version + run: | + "$(xcrun -f swift)" --version - name: Pre-build run: ${{ inputs.ios_pre_build_command }} - name: Build