Compile error enabled swift library evolution with Xcode12.5

In mixing swift and oc project,target is static framework and enabled swift library evolution.

In Xcode12.0, everything is fine. When you upgrade to Xcode12.5, the project compiler error with:

Error Log

Code Block language
Showing All Messages
Prepare build
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Using build description from disk
note: Build preparation complete
Build target TestFramework of project TestFramework with configuration Debug
....
/Users/zhangyu81/Library/Developer/Xcode/DerivedData/TestFramework-bnulduitccqmyadwwhoycushfino/Build/Products/Debug-iphoneos/TestFramework.framework/Modules/module.modulemap:9:12: error: header 'TestFramework-Swift.h' not found
header "TestFramework-Swift.h"
^
/Users/zhangyu81/Library/Developer/Xcode/DerivedData/TestFramework-bnulduitccqmyadwwhoycushfino/Build/Intermediates.noindex/TestFramework.build/Debug-iphoneos/TestFramework.build/Objects-normal/arm64/TestFramework.swiftinterface:6:19: error: could not build Objective-C module 'TestFramework'
@_exported import TestFramework
^
/Users/zhangyu81/Library/Developer/Xcode/DerivedData/TestFramework-bnulduitccqmyadwwhoycushfino/Build/Intermediates.noindex/TestFramework.build/Debug-iphoneos/TestFramework.build/Objects-normal/arm64/TestFramework.swiftinterface:1:1: error: failed to verify module interface of 'TestFramework'; it may have been damaged or it may have triggered a bug in the Swift compiler when it was produced
// swift-interface-format-version: 1.0
^
Command VerifyModuleInterface failed with a nonzero exit code
Build failed 2021/5/24, 5:07 PM 4.1 seconds


Build Setp:

- Compile Swift source files:
  • Verify swiftinterface (arm64):

- Command VerifyModuleInterface failed with a nonzero exit code

Reason?

Enable BUILD_LIBRARY_FOR_DISTRIBUTION will trigger swiftinterface verification after all Swift compilation is completed, and the verification will use ModuleMap, but the "SWIFT. H" file referenced in ModuleMap has not been copied into the binary of Target, so the trigger error: "header 'TestFramework-Swift.h' not found"

Is it a Swift compiler bug? Thanks any reply

Answered by dreamno23 in 675494022
Resolved by switch swift toolchain xcode default version.
Reason is compiled with swift toolchain-5.4.

Maybe Swift Release 5.4 will embeded in next xcode version!


Accepted Answer
Resolved by switch swift toolchain xcode default version.
Reason is compiled with swift toolchain-5.4.

Maybe Swift Release 5.4 will embeded in next xcode version!


Compile error enabled swift library evolution with Xcode12.5
 
 
Q