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.
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.
MacOS Big Sur 11.0.1
Mac Mini with M1 chip
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.a and the other artefacts.
Forking the library and updating the build script to also build for the iPhoneSimulator-arm64 target might be an option.
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 libevent correctly for all targets, including arm64 iPhoneSimulator:
https://gist.github.com/andreialecu/2cc00a5e7212bf3b935afd015d693877
However, lipo cannot be used to merge both the iOS and simulator arm64 slice into the same output file:
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: /Users/andreialecu/Work/contrib/libevent-builder/build/built/iPhoneSimulator-arm64.sdk/lib/libevent.a and /Users/andreialecu/Work/contrib/libevent-builder/build/built/iPhoneOS-arm64.sdk/lib/libevent.a have the same architectures (arm64) and can't be in the same fat output file
What this means is that they need to be converted into an xcframework with 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 think I got the same error a few hours ago too, I just checked Xcode to run in Rosetta 2 and it worked :)
EDIT: sorry I didn't realized you were actually trying to fix this error; my mistake ;)
Fixing this issue also helps Catalyst.
IMO, we should use XCframework rather than a .a file.
Any updates here?
@hsavit1 it doesn't look like the base library didn't receive an update yet (https://github.com/e314521/CocoaLibEvent), once it does, we can bump our dep. I assume that the Folly project in general won't be compatible with M1 yet for the same reason. But as far as I can see M1 isn't officially support by React Native yet? So until that is the case I guess this one is pending :)
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.
Ok, let's wait until official support lands in React Native, if I'm not
mistaken they depend on Folly as well.
On Thu, 28 Jan 2021, 16:38 Andrei Alecu, notifications@github.com wrote:
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.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/facebook/flipper/issues/1758#issuecomment-769212455,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAN4NBHLYIZGZZZBAJI57NDS4GHJHANCNFSM4UYFFQAQ
.
RN works on M1.
I have several projects using it natively on M1 with native arm64 compilation (no need to use Rosetta)
It only works with Flipper disabled though. See https://github.com/react-native-community/discussions-and-proposals/issues/295#issuecomment-753470834 and other comments in that issue.
Did it work out of the box / is it officially sorted, or did you need
manual changes? Since the issue is still open I assumed support is not
official? But I might have misread it.
On Thu, 28 Jan 2021, 18:05 Andrei Alecu, notifications@github.com wrote:
RN works on M1.
I have several projects using it natively on M1 with native arm64
compilation (no need to use Rosetta)It only works with Flipper disabled though. See react-native-community/discussions-and-proposals#295
(comment)
https://github.com/react-native-community/discussions-and-proposals/issues/295#issuecomment-753470834
and other comments in that issue.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/facebook/flipper/issues/1758#issuecomment-769271696,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAN4NBEYMOB5UNAHMJM6E4DS4GRPFANCNFSM4UYFFQAQ
.
The reason I ask being, in the official case Id expect to be able to find a
similar changeset for RN or newer version for Folly
On Thu, 28 Jan 2021, 18:13 Michel Weststrate, mweststrate@gmail.com wrote:
Did it work out of the box / is it officially sorted, or did you need
manual changes? Since the issue is still open I assumed support is not
official? But I might have misread it.On Thu, 28 Jan 2021, 18:05 Andrei Alecu, notifications@github.com wrote:
RN works on M1.
I have several projects using it natively on M1 with native arm64
compilation (no need to use Rosetta)It only works with Flipper disabled though. See react-native-community/discussions-and-proposals#295
(comment)
https://github.com/react-native-community/discussions-and-proposals/issues/295#issuecomment-753470834
and other comments in that issue.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/facebook/flipper/issues/1758#issuecomment-769271696,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAN4NBEYMOB5UNAHMJM6E4DS4GRPFANCNFSM4UYFFQAQ
.
it's a discussion in the react native discussion group, not an issue on react native itself
yes it does work out of the box, but flipper does not. I've kept the issue open because flipper does not work
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.
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.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/facebook/flipper/issues/1758#issuecomment-769293729,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAN4NBFPREZIPIM5RT577FTS4GV4PANCNFSM4UYFFQAQ
.
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.
See #1892
Better if we can leverage source code instead of pre-built binary. CocoaLibEvent is a binary.
When I upgraded my Podfiles with
use_flipper!({ 'Flipper' => '0.75.0' })
I get this error after building the project
dyld: Library not loaded: @rpath/OpenSSL.framework/OpenSSL
more specifically,
dyld: dependent dylib '@rpath/OpenSSL.framework/OpenSSL' not found for '/private/var/folders/dj/7qqc0gpn6m9cwbnf0ztxs6qc0000gn/X/8435F332-4636-56B5-9086-0A79F18EB13B/d/Wrapper/Debug MyApp.app/Debug MyApp'. could not use '/Users/XXX/Library/Developer/Xcode/DerivedData/my_app-cyrdziywztcwbiakcqkhovpxhvfy/Build/Products/Debug-iphoneos/OpenSSL.framework/OpenSSL' because it was not built for platform iOS
Since the original issue has been solved and an update is released. Closing this issue. For any further questions / fallout, please open a fresh issue.
Most helpful comment
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.