Xcodebuild assuming highest minimum deployment target for package dependencies with no explicit platform

I'm using swift-create-xcframework to create an XCFramework from my Swift package. I have combed through the source code and I don't think this tool is the problem, though it will obviously need to be updated with whatever the solution is, since it is what calls into xcodebuild.

Anyway, my package has one explicit dependency, which itself does not specify a minimum deployment target. xcodebuild is assuming a deployment target of 18.1 for that dependency, which is the highest Xcode 16.1 supports.

From the build output, note the 18.1 target:

WriteAuxiliaryFile /…/DerivedData/…/Jsum.build/Release-iphoneos/CEcho.build/Objects-normal/arm64/…-common-args.resp (in target 'CEcho' from project 'Jsum')
    cd /Users/tanner/Repos/Jsum
    write-file /…/DerivedData/…/Jsum.build/Release-iphoneos/CEcho.build/Objects-normal/arm64/…-common-args.resp
-target arm64-apple-ios18.1 -fpascal-strings -Os '-DSWIFT_PACKAGE=1' …

And the error:

EmitSwiftModule normal arm64 (in target 'Jsum' from project 'Jsum')
    cd /Users/tanner/Repos/Jsum
    /Applications/Xcode-16.1.0.app/…/swift-frontend …
/…/EchoExtensions.swift:10:8: error: compiling for iOS 12.0, but module 'Echo' has a minimum deployment target of iOS 18.1: /…/Jsum/.build/swift-create-xcframework/build/Release-iphoneos/Echo.framework/Modules/Echo.swiftmodule/arm64-apple-ios.swiftmodule
import Echo
       ^

I might have opened an issue on the repo for this tool, but it is a corporate published tool and they have issues turned off. I'm hoping someone here knows what I can do instead.

I tried passing this argument for xcodebuild I thought might help to no avail:

--xc-setting OTHER_SWIFT_FLAGS="-target arm64-apple-ios12.0"

Here is the full command I'm running, sans the above argument:

swift create-xcframework --platform ios > build.log

If you want to help debug this, installing the tool is simple:

brew install segment-integrations/formulae/swift-create-xcframework

Edit: solution: --xc-setting IPHONEOS_DEPLOYMENT_TARGET=12.0

Possibly related issue?

What about setting the IPHONEOS_DEPOYMENT_TARGET rather than a target triple? But this is odd, as unspecified deployment targets should get the minimum (default) deployment target from SPM, not the maximum.

Perhaps somewhat related, I was surprised recently when updating an Xcode project to a minimum deployment target of iOS 17: Xcode actually set it to 17.1 or something, even though the drop down menu said 17… I had to go in and hand-edit the Xcode project file.

Yeah, Xcode 16 seems to have replaced the minor version picker with major versions, but insists on then choosing the minor version. I suggest setting the value directly in your build settings rather than Xcode's UI. You should be able to edit the string to whatever version you want.

1 Like

Hah, yeah. I think I edited the project file since that’s where I saw the issue in the git change :).

Hmmm no dice either, same errors. If this isn't normal behavior though, that motivates me to reach out to the authors of this tool somehow then

Edit: I had copy-pasted the flag from your comment, but you made a typo—the correct spelling did the trick! Thank you!