flipper: Apple M1 chip: ARM64 simulator build fails / CocoaLibEvent
🐛 Bug Report
The PR #1735 fixes part of the issue with building Flipper for the Arm64 iOS simulator used on M1 Macs.
Even though the fix above is not yet released, I was able to test it via the mechanism described in this post: https://github.com/facebook/react-native/pull/30543#issuecomment-743753611
However, linking now fails with this error:
in .../ios/Pods/CocoaLibEvent/lib/libevent.a(buffer.o), building for iOS Simulator, but linking in object file built for iOS, file '.../ios/Pods/CocoaLibEvent/lib/libevent.a' for architecture arm64
See:
https://github.com/facebook/flipper/blob/031cec299b527975cd1e252177372bb33cb0ae18/iOS/Podspecs/Flipper-Folly.podspec#L20 https://github.com/e314521/CocoaLibEvent
That library seems pretty obscure and doesn’t seem maintained at all.
To Reproduce
Use an M1 mac, replace use_flipper! with use_flipper!('Flipper-Folly' => { :podspec => 'https://raw.githubusercontent.com/facebook/flipper/master/iOS/Podspecs/Flipper-Folly.podspec' } ). Run build in XCode, see above error.
Environment
MacOS Big Sur 11.0.1 Mac Mini with M1 chip
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 21 (10 by maintainers)
Small update: we are currently looking into it. So hopefully we will be able to address it this week or next week. It might be the case that we can address it only in the next RN release, not sure about that yet.
Check, thanks for the update, I’ll check if I can find someone for this tomorrow. We will probably need help with testing 😊
On Thu, 28 Jan 2021, 18:43 Andrei Alecu, notifications@github.com wrote:
With Flipper being enabled by default and part of the official RN documentation, it seems like RN isn’t going to advertise Apple Silicon support until Flipper works.
So RN is blocked on this issue itself.
See #1892
yes it does work out of the box, but flipper does not. I’ve kept the issue open because flipper does not work
Doesn’t seem likely that the base library will ever be updated by the looks of it.
I posted steps on how to fix it above, someone needs to step up. I’d do it but I’m not familiar enough with the native mac development intricacies.
I spent some time looking into what it would take to update the binaries to be compatible and here are my findings:
I worked on an updated script that will build
libeventcorrectly for all targets, includingarm64iPhoneSimulator: https://gist.github.com/andreialecu/2cc00a5e7212bf3b935afd015d693877However,
lipocannot be used to merge both the iOS and simulatorarm64slice into the same output file:What this means is that they need to be converted into an
xcframeworkwith separate outputs similar to what OpenSSL-Universal does:https://github.com/krzyzanowskim/OpenSSL/blob/5fe27f6accc02fb666175f65b83c1552030f3669/scripts/create-frameworks.sh https://github.com/krzyzanowskim/OpenSSL/tree/5fe27f6accc02fb666175f65b83c1552030f3669/Frameworks
Hopefully someone can take over this work. It was a fun experiment. In the mean time I’ll resort to disabling Flipper until this is resolved.
I was able to find this script: https://github.com/e314521/ios-lib/blob/fa1246cbaa0ea664ee285690aedf551ff7753f85/build-libevent.sh
It seems to be what builds
libevent.aand the other artefacts.Forking the library and updating the build script to also build for the
iPhoneSimulator-arm64target might be an option.