gurhub / surmagic

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

Xcode 12 - fatal error lipo #4

Closed frovera closed 3 years ago

frovera commented 3 years ago

First of all thanks for your tutorial. I have developed a library that must work both on simulators and on physical devices hence the need to create a fat framework.

I followed your istructions and build your script, unfortunately I get a fatal error at STEP 3 (... have the same architectures (arm64) and can't be in the same fat output file).

Details :

⏱Starting the Universal Framework work... 

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

 πŸš€ Step 1-1: Building for iphonesimulator

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

2020-09-22 14:20:49.926 xcodebuild[19152:440414]  DTDeviceKit: deviceType from aa02380574025d12b6a86713c0a5c871122e93a8 was NULL
2020-09-22 14:20:50.088 xcodebuild[19152:440404]  DTDeviceKit: deviceType from aa02380574025d12b6a86713c0a5c871122e93a8 was NULL
2020-09-22 14:20:50.088 xcodebuild[19152:440404]  DTDeviceKit: deviceType from aa02380574025d12b6a86713c0a5c871122e93a8 was NULL

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

 πŸš€ Step 1-2: Building for iphoneos 

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

 πŸ“¦ Step 2: Copy the framework structure for iphoneos

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

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

 πŸ›  Step 3: The LIPO Step

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

fatal error: lipo: /Users/francesco/Library/Developer/Xcode/DerivedData/XXX-ejajnmazbewoplbnwyfgpckisukh/Build/Products/Release-iphonesimulator/XXX.framework/XXX and /Users/francesco/Library/Developer/Xcode/DerivedData/XXX-ejajnmazbewoplbnwyfgpckisukh/Build/Products/Release-iphoneos/XXX.framework/XXX have the same architectures (arm64) and can't be in the same fat output file

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

 πŸ“¦ Step 4: Copy the Swiftmodules

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

cp: /Users/francesco/Library/Developer/Xcode/DerivedData/XXX-ejajnmazbewoplbnwyfgpckisukh/Build/Products/Release-iphonesimulator/XXX.framework/Modules/XXX.swiftmodule/Project is a directory (not copied).

cp: /Users/francesco/Library/Developer/Xcode/DerivedData/XXX-ejajnmazbewoplbnwyfgpckisukh/Build/Products/Release-iphoneos/XXX.framework/Modules/XXX.swiftmodule/Project is a directory (not copied).

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

 πŸš› Step 5 Copying in the project directory

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

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

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

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

 🏁 Completed with Success! πŸ™‚

 πŸ” For more details you can always check the /tmp/XXX_archive.log file. πŸ“ 

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

I replaced my library name with XXX.

Could you help me to solve it please? Thank you

gurhub commented 3 years ago

Hi, you're welcome, I'm glad you used the script :)

I have checked your output, you get a Lipo error just like you said. You can check the Demo application for the Build Settings. Probably you have different settings somewhere. I was also getting Lipo errors too. For me, the solution was making a similar Build Setting with the working project.

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

Best.

bot509 commented 3 years ago

@gurhub I got the same error with Xcode 12, I guess Xcode 12 will build arm64 default for simulator, to support Mac silicone. How do I change the build setting to avoid this fatal error of lipo?

I found this article to remove arm64 for simulator: https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios

but I think we should resolve this problem on lipo stage. we'd better ignore the same arch when lipo merge.