From 38d023632d0f8ccd821216cbf0566f57ea96ea80 Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Thu, 11 Dec 2025 23:03:29 +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/swift_package_test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/swift_package_test.yml b/.github/workflows/swift_package_test.yml index a81d047d..75a0e6dc 100644 --- a/.github/workflows/swift_package_test.yml +++ b/.github/workflows/swift_package_test.yml @@ -130,7 +130,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" @@ -295,7 +295,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