Pierre
Pierre

Reputation: 451

Xcode 14 - Minimum deployment target for SPM package

I am actually compiling for macOS 10.12, as stated. I import the Reachability.swift package, that is compatible down to 10.9. No minimum version is indicated within the Package.swift file. However, I get this error while compiling :

Compiling for macOS 10.12, but module 'Reachability' has a minimum deployment target of macOS 10.13

It happens since I updated to Xcode 14, with version 13, there was no problem. If I specify the minimum version in the Package.swift of Reachability platforms:[.macOS(.v10_10)],, I clean all the caches, I get the same problem.

I could probably upgrade deployment target to 10.13 (same computer compatibility) or simply include the Reachability.swift file in my code, but I would rather that it works...

[EDIT] Note : other packages, like AppCenter, do not have the same problem… which is weird.

[EDIT 2] With the release of Xcode 14.1, the problem remains the same.

Do you have any suggestion?

Upvotes: 3

Views: 2569

Answers (1)

kakaiikaka
kakaiikaka

Reputation: 4477

I can reproduce your problem: Using AppCenter is OK, but the reachability throws an error.

Here is what I found and maybe this is the root cause:

  1. Make Reachability a local SPM, and modify its swift-tool-version settings and platform settings to align with AppCenter.

    SPM Modification

  2. Then if you click into the .v10_12 MacOSVersion, you will find os versions lower than 10.13 has all been marked as unsupported

10.13 below is unsupported now

  1. If you head to the built files, test it with otool, you will find the built product's minimum supported version matches with the above description: enter image description here So even if you specify the minimum support version to 10.12, the build tools will still target 10.13.

  2. If you check LC_MIN_VERSION_MACOSX on AppCenter. It is also targeting 10.13 instead of 10.12 in its package.swift file.

  3. But why Xcode accepts AppCenter and raise an error for Reachability?

enter image description here

Check the build log below. You will find it in the emitting module stage, the build system is using swift-frontend to embed those 3rd party dependencies. So I guess since the AppCenter is written in objective C.

The checking minimum os version behavior of swift-frontend is different between OC Dependency "AppCenter" and Swift Dependency "Reachability."

enter image description here

Upvotes: 4

Related Questions