Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XCode 12 Support #89

Closed
wants to merge 1 commit into from
Closed

XCode 12 Support #89

wants to merge 1 commit into from

Conversation

Unknoob
Copy link

@Unknoob Unknoob commented Oct 1, 2020

When using Rome on XCode 12, we get an error when merging the Simulator and Device frameworks.

fatal error: /Applications/Xcode12.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: 
/Users/{REDACTED}/Rome/build/Release-iphoneos/FBSDKCoreKit/FBSDKCoreKit.framework/FBSDKCoreKit 
and 
/Users/{REDACTED}/Rome/build/Release-iphonesimulator/FBSDKCoreKit/FBSDKCoreKit.framework/FBSDKCoreKit 
have the same architectures (arm64) and can't be in the same fat output file

That happens because when compiling for a Simulator on XCode 12, we end up with both x86_64 and arm64 binaries(thanks to the new arm Macs).
To fix the problem I added a build setting to build only x86_64 architecture when building for the Simulator, that way we can merge it normally after both are compiled.

I still need help with 2 things.

  • Does the arm64 binary built for a device work normally in the arm64 simulator in new macs?
  • Could I instead simply build it for Simulator and use the arm64 slice to run it on a Device? And would it cause problems with the dsym files?

The fix worked for me and may help some other people having this same error, but I'm not sure if I'm breaking the Simulator support on arm Macs, so any help would be appreciated.

@Unknoob Unknoob changed the title XCode 12 fix XCode 12 Support Oct 1, 2020
@kj800x
Copy link

kj800x commented Feb 18, 2021

I also ran into this same issue today where my built frameworks weren't working on the simulator. Discovered the same thing that you did, the lipo command to merge the simulator and on-device frameworks failed and I ended up with a framework that only supported on-device. This fix looks good to me (although I'm just a stranger on the internet who has no actual ruby experience, not a maintainer of this project).

Here's the current output of file on the framework if I only generate the simulator build:

kjohnson@sudowoodo ~/src/framework-generator/ios/build/Release-iphonesimulator/React-RCTBlob/RCTBlob.framework $ file RCTBlob
RCTBlob: Mach-O universal binary with 3 architectures: [i386:Mach-O dynamically linked shared library i386] [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
RCTBlob (for architecture i386):	Mach-O dynamically linked shared library i386
RCTBlob (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
RCTBlob (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

It might be better to use EXCLUDED_ARCHS=arm64 to be more futureproof. Right now the simulator builds include i386, x86_64, and arm64 and I think we only need to remove arm64. On the other hand, we probably aren't losing much by dropping i386 support.

This relates to #65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants