Swift Version Conflict: this SDK is not supported by the compiler - using BUILD_LIBRARY_FOR_DISTRIBUTION setting. What could be the issue?
Asked Answered
E

0

9

I'm building a Swift static library with:

  • Xcode 13.2 (Swift compiler 5.5.2)
  • iOS Deployment target 12.0
  • Build library for distribution YES
  • Skip install NO
  • Swift language version 5 and tried with 4.2 Dependency managed with CocoaPods:
  • Japx 3.0.0
  • Alamofire 5.2.2
  • RxSwift

When I try to add it to an iOS project with this setup:

  • Xcode 13.3 (Swift compiler 5.6)
  • iOS Deployment target 12.0
  • Swift language version 5 and tried with 4.2 and build I get this error:
Failed to build module 'LibraryX'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.5.2 effective-4.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)', while this compiler is 'Apple Swift version 5.6 effective-4.2 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)'). Please select a toolchain which matches the SDK.

These are the headers in the .swiftinterface

// swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.5.2 effective-4.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
// swift-module-flags: -target arm64-apple-ios12.0 -enable-objc-interop -enable-library-evolution -swift-version 4.2 -enforce-exclusivity=checked -Onone -module-name LibraryX

Obviously if I build the project with the same compiler version or building the library with the iOS project everything works fine. But the purpose here is to release a precompiled library and not its source code.

Every time that I lookup this error online I've found "You have to set Build library for distribution to Yes"

I tried to add the source code of the static library to a new Framework project, but I get the same result.

Edirne answered 29/3, 2022 at 8:49 Comment(1)
did you find out how to fix this ?Kessinger

© 2022 - 2024 — McMap. All rights reserved.