gurhub / surmagic

🚀 Command Line Tool to create XCFramework for multiple platforms in one shot!
MIT License
310 stars 43 forks source link

Module compiled with Swift 5.2.4 cannot be imported by the Swift 5.1.3 compiler #3

Closed RaviKiranMakala closed 3 years ago

RaviKiranMakala commented 3 years ago

Hi, I am using Xcode 11.7. I downloaded your fat library and made build settings of my framework similar to your framework. I am able to create a framework successfully. But when i try to use this in host application, it is giving me an error:

Module compiled with Swift 5.2.4 cannot be imported by the Swift 5.1.3 compiler

I came to know that it is due to BUILD_LIBRARY_FOR_DISTRIBUTION is set to NO. When i change it to BUILD_LIBRARY_FOR_DISTRIBUTION to YES it gives me the following error.

`⏱ Starting the Universal Framework work...

##################################################################

DEVICE_LIBRARY_PATH: /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-iphoneos/IBTemperatureFramework.framework SIMULATOR_LIBRARY_PATH: /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-iphonesimulator/IBTemperatureFramework.framework UNIVERSAL_LIBRARY_DIR: /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-Universal

##################################################################

##################################################################

🚀 Step 1-1: Building for iphonesimulator

##################################################################

2020-09-21 13:24:56.518 xcodebuild[19724:330689] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:24:58.204 xcodebuild[19724:330689] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:24:58.268 xcodebuild[19724:330689] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:24:58.275 xcodebuild[19724:330689] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:24:58.287 xcodebuild[19724:330689] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:24:58.295 xcodebuild[19724:330689] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:24:58.303 xcodebuild[19724:330689] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:24:58.308 xcodebuild[19724:330689] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:24:59.151 xcodebuild[19724:330689] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () CLEAN FAILED

The following build commands failed: Check dependencies (1 failure) BUILD FAILED

The following build commands failed: Check dependencies (1 failure)

##################################################################

🚀 Step 1-2: Building for iphoneos

2020-09-21 13:25:00.894 xcodebuild[19736:330944] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:25:02.537 xcodebuild[19736:330944] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:25:02.595 xcodebuild[19736:330944] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:25:02.602 xcodebuild[19736:330944] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:25:02.614 xcodebuild[19736:330944] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:25:02.621 xcodebuild[19736:330944] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:25:02.629 xcodebuild[19736:330944] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:25:02.635 xcodebuild[19736:330944] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () 2020-09-21 13:25:03.274 xcodebuild[19736:330944] [MT] DVTDeveloperPaths: WARNING: Environment variable XCODE_DEVELOPER_DIR_PATH is set, but is not an absolute path. The variable will be ignored. () CLEAN FAILED

The following build commands failed: Check dependencies (1 failure) BUILD FAILED

The following build commands failed: Check dependencies (1 failure)

##################################################################

📦 Step 2: Copy the framework structure for iphoneos

##################################################################

##################################################################

🛠 Step 3: The LIPO Step

##################################################################

fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-iphonesimulator/IBTemperatureFramework.framework/IBTemperatureFramework (No such file or directory)

##################################################################

📦 Step 4: Copy the Swiftmodules

##################################################################

ℹ️ Couldn't any Swift module file for SIMULATOR!

cp: /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-Universal/IBTemperatureFramework.framework/Modules/IBTemperatureFramework.swiftmodule/arm64-apple-ios.swiftdoc and /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-iphoneos/IBTemperatureFramework.framework/Modules/IBTemperatureFramework.swiftmodule/arm64-apple-ios.swiftdoc are identical (not copied). cp: /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-Universal/IBTemperatureFramework.framework/Modules/IBTemperatureFramework.swiftmodule/arm64-apple-ios.swiftinterface and /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-iphoneos/IBTemperatureFramework.framework/Modules/IBTemperatureFramework.swiftmodule/arm64-apple-ios.swiftinterface are identical (not copied). cp: /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-Universal/IBTemperatureFramework.framework/Modules/IBTemperatureFramework.swiftmodule/arm64-apple-ios.swiftmodule and /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-iphoneos/IBTemperatureFramework.framework/Modules/IBTemperatureFramework.swiftmodule/arm64-apple-ios.swiftmodule are identical (not copied). cp: /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-Universal/IBTemperatureFramework.framework/Modules/IBTemperatureFramework.swiftmodule/arm64.swiftdoc and /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-iphoneos/IBTemperatureFramework.framework/Modules/IBTemperatureFramework.swiftmodule/arm64.swiftdoc are identical (not copied). cp: /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-Universal/IBTemperatureFramework.framework/Modules/IBTemperatureFramework.swiftmodule/arm64.swiftinterface and /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-iphoneos/IBTemperatureFramework.framework/Modules/IBTemperatureFramework.swiftmodule/arm64.swiftinterface are identical (not copied). cp: /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-Universal/IBTemperatureFramework.framework/Modules/IBTemperatureFramework.swiftmodule/arm64.swiftmodule and /Users/macbookpro/Library/Developer/Xcode/DerivedData/IBTemperatureFramework-bawmlixzprhuyrdpharpxvruwypv/Build/Intermediates.noindex/ArchiveIntermediates/IBTemperatureFramework/BuildProductsPath/Release-iphoneos/IBTemperatureFramework.framework/Modules/IBTemperatureFramework.swiftmodule/arm64.swiftmodule are identical (not copied).

##################################################################

🚛 Step 5 Copying in the project directory

##################################################################

##################################################################

##################################################################

##################################################################

🏁 Completed with Success! 🙂

🔍 For more details you can always check the /tmp/IBTemperatureFramework_archive.log file. 📝

################################################################## `

Can you help me out .

gurhub commented 3 years ago

Hi,

setting the BUILD_LIBRARY_FOR_DISTRIBUTION to YES can possibly cause another error (like in your case).

For your case, I found this answer on the SO:

This problem is caused by the fact that you attempt to embed a pre-compiled framework that was created with a different compiler version. ... As already mentioned in one of the comments, the solution to this problem is to up- or downgrade to the appropriate Xcode version. (Or, if possible, recompile the framework with the desired compiler version and then use the same compiler version for your project.) ...

The last paragraph explains the solution for your case I believe.

I'm closing because this is not related to the Script file itself.

Best.