Skip to content

hermes.framework is incompatible with iOS Simulator on Apple M1 Macs #468

@Arkkeeper

Description

@Arkkeeper

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

  1. Set :hermes_enabled => true in Podfile
  2. Build React Native project for iOS Simulator
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    community-support-neededFacebook can't provide direct support for this issue, it is up to the community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions