-
Notifications
You must be signed in to change notification settings - Fork 707
Description
Bug Description
There are such lines in utils/build-ios-framework.sh:
build_apple_framework "iphoneos" "armv7;armv7s;arm64" "$ios_deployment_target"
build_apple_framework "iphonesimulator" "x86_64;i386" "$ios_deployment_target"
create_universal_framework "iphoneos" "iphonesimulator"
But on M1 Macs, arm64 architecture should be used both for "iphoneos" and for "iphonesimulator", otherwise build will fail and RN won't compile with Hermes enabled.
If I get Hermes source code and change those lines to:
#build_apple_framework "iphoneos" "armv7;armv7s;arm64" "$ios_deployment_target"
build_apple_framework "iphonesimulator" "x86_64;arm64" "$ios_deployment_target"
#create_universal_framework "iphoneos" "iphonesimulator"
and then run ./build-ios-framework.sh, it compiles appropriate version of framework. Putting that hermes.framework in Pods/hermes-engine/destroot/Library/Frameworks/iphoneos allows Xcode to build and run in iOS Simulator successfully.
Unfortunately, it isn't possible to compile universal framework containing arm64 architecture both for iphoneos and for iphonesimulator, because fat frameworks can't include the same architecture twice. The only workaround I have tested is creating xcframework with:
xcodebuild -create-xcframework -framework ...path-to-iphoneos-hermes.framework -framework ...path-to-iphonesimulator-hermes.framework -output ~/hermes.xcframework
The amount of Apple Silicon Mac users is growing rapidly, so I'm sure that this issue is rather important.
- I have run
gradle clean
and confirmed this bug does not occur with JSC
Hermes version: 0.7.2
React Native version (if any): 0.64
OS version (if any): macOS 11.2.3 (Apple M1)
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): arm64
Steps To Reproduce
- Set
:hermes_enabled => true
in Podfile - Build React Native project for iOS Simulator
- Build fails with:
building for iOS Simulator, but linking in dylib built for iOS, file '/Users/arkkeeper/git/projecto_mobile/ios/Pods/hermes-engine/destroot/Library/Frameworks/iphoneos/hermes.framework/hermes' for architecture arm64
The Expected Behavior
When installing Hermes from cocoapods with React Native scripts, hermes.framework should be compiled as xcframework supporting arm64 both for iOS devices and Xcode simulators.