react-native: Unable to run fresh new React Native project (possible arm64 processor issue)

Description

Unable to run react-native on brand new (and existing) projects. Possible ARM processor issue, running out latest MacBook Pro with M1 chip. I first experienced it on a going project then I created a fresh new project to test it.

React Native version:

System:
    OS: macOS 11.2.3
    CPU: (8) arm64 Apple M1
    Memory: 129.91 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 15.10.0 - /var/folders/k4/zplkz0553rx5g6996c78sshm0000gn/T/yarn--1615297647196-0.7821398534825572/node
    Yarn: 1.22.10 - /var/folders/k4/zplkz0553rx5g6996c78sshm0000gn/T/yarn--1615297647196-0.7821398534825572/yarn
    npm: 7.5.3 - /opt/homebrew/bin/npm
    Watchman: 4.9.0 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.3
      System Images: android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_275 - /usr/bin/javac
    Python: 3.8.5 - /Users/du5rte/opt/anaconda3/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.4 => 0.63.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. run npx react-native init AwesomeProject
  2. run yarn ios

Expected Results

Expected App to start

Errors

fatal error: 'event2/event-config.h' file not found
#include <event2/event-config.h>

Followed suggested fixes mentioned on #30836 In Podfile, tried both:

use_flipper!({ 'Flipper-Folly' => '2.3.0' })

and

use_flipper!({'Flipper' => '0.79.0'})
  • Removed Pods and Podfile.lock files.
  • run pod install
  • run yarn ios

Get the following errors:

Ld /Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/AwesomeProject.app/AwesomeProject normal (in target 'AwesomeProject' from project 'AwesomeProject')
    cd /Users/du5rte/Documents/Playground/AwesomeProject/ios
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-ios10.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphonesimulator -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/CocoaAsyncSocket -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/DoubleConversion -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/FBReactNativeSpec -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/Flipper -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/Flipper-DoubleConversion -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/Flipper-Folly -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/Flipper-Glog -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/Flipper-PeerTalk -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/Flipper-RSocket -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/FlipperKit -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/Folly -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/RCTTypeSafety -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-Core -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-CoreModules -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-RCTAnimation -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-RCTBlob -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-RCTImage -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-RCTLinking -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-RCTNetwork -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-RCTSettings -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-RCTText -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-RCTVibration -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-cxxreact -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-jsi -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-jsiexecutor -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/React-jsinspector -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/ReactCommon -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/Yoga -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/YogaKit -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/glog -L/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/libevent -F/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator -F/Users/du5rte/Documents/Playground/AwesomeProject/ios/Pods/OpenSSL-Universal/Frameworks -F/Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/OpenSSL -filelist /Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Intermediates.noindex/AwesomeProject.build/Debug-iphonesimulator/AwesomeProject.build/Objects-normal/arm64/AwesomeProject.LinkFileList -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Intermediates.noindex/AwesomeProject.build/Debug-iphonesimulator/AwesomeProject.build/Objects-normal/arm64/AwesomeProject_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -ObjC -lCocoaAsyncSocket -lDoubleConversion -lFBReactNativeSpec -lFlipper -lFlipper-DoubleConversion -lFlipper-Folly -lFlipper-Glog -lFlipper-PeerTalk -lFlipper-RSocket -lFlipperKit -lFolly -lRCTTypeSafety -lReact-Core -lReact-CoreModules -lReact-RCTAnimation -lReact-RCTBlob -lReact-RCTImage -lReact-RCTLinking -lReact-RCTNetwork -lReact-RCTSettings -lReact-RCTText -lReact-RCTVibration -lReact-cxxreact -lReact-jsi -lReact-jsiexecutor -lReact-jsinspector -lReactCommon -lYoga -lYogaKit -lglog -llibevent -lstdc++ -framework AudioToolbox -framework CFNetwork -framework JavaScriptCore -framework MobileCoreServices -framework OpenSSL -framework Security -framework UIKit -ObjC -lc++ -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Intermediates.noindex/AwesomeProject.build/Debug-iphonesimulator/AwesomeProject.build/AwesomeProject.app-Simulated.xcent -lPods-AwesomeProject -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Intermediates.noindex/AwesomeProject.build/Debug-iphonesimulator/AwesomeProject.build/Objects-normal/arm64/AwesomeProject_dependency_info.dat -o /Users/du5rte/Library/Developer/Xcode/DerivedData/AwesomeProject-akghlijokryubcdjzzeipuldirpe/Build/Products/Debug-iphonesimulator/AwesomeProject.app/AwesomeProject

ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
Undefined symbols for architecture arm64:
  "protocol descriptor for Swift.ExpressibleByFloatLiteral", referenced from:
      l_got.$ss25ExpressibleByFloatLiteralMp in libYogaKit.a(YGLayoutExtensions.o)
  "associated type descriptor for Swift.ExpressibleByIntegerLiteral.IntegerLiteralType", referenced from:
      l_got.$s18IntegerLiteralTypes013ExpressibleByaB0PTl in libYogaKit.a(YGLayoutExtensions.o)
  "associated conformance descriptor for Swift.ExpressibleByIntegerLiteral.Swift.ExpressibleByIntegerLiteral.IntegerLiteralType: Swift._ExpressibleByBuiltinIntegerLiteral", referenced from:
      l_got.$ss27ExpressibleByIntegerLiteralP0cD4TypeAB_s01_ab7BuiltincD0Tn in libYogaKit.a(YGLayoutExtensions.o)
  "method descriptor for Swift.ExpressibleByFloatLiteral.init(floatLiteral: A.FloatLiteralType) -> A", referenced from:
      l_got.$ss25ExpressibleByFloatLiteralP05floatD0x0cD4TypeQz_tcfCTq in libYogaKit.a(YGLayoutExtensions.o)
  "protocol descriptor for Swift.ExpressibleByIntegerLiteral", referenced from:
      l_got.$ss27ExpressibleByIntegerLiteralMp in libYogaKit.a(YGLayoutExtensions.o)
  "value witness table for Builtin.Int32", referenced from:
      full type metadata for __C.YGUnit in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftCoreImage", referenced from:
      __swift_FORCE_LOAD_$_swiftCoreImage_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreImage_$_YogaKit)
  "associated type descriptor for Swift.ExpressibleByFloatLiteral.FloatLiteralType", referenced from:
      l_got.$s16FloatLiteralTypes013ExpressibleByaB0PTl in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftQuartzCore", referenced from:
      __swift_FORCE_LOAD_$_swiftQuartzCore_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftQuartzCore_$_YogaKit)
  "__swift_FORCE_LOAD_$_swiftDispatch", referenced from:
      __swift_FORCE_LOAD_$_swiftDispatch_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftDispatch_$_YogaKit)
  "method descriptor for Swift.ExpressibleByIntegerLiteral.init(integerLiteral: A.IntegerLiteralType) -> A", referenced from:
      l_got.$ss27ExpressibleByIntegerLiteralP07integerD0x0cD4TypeQz_tcfCTq in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftCoreFoundation", referenced from:
      __swift_FORCE_LOAD_$_swiftCoreFoundation_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreFoundation_$_YogaKit)
  "protocol witness table for Swift.Int : Swift._ExpressibleByBuiltinIntegerLiteral in Swift", referenced from:
      associated type witness table accessor for Swift.ExpressibleByIntegerLiteral.IntegerLiteralType : Swift._ExpressibleByBuiltinIntegerLiteral in __C.YGValue : Swift.ExpressibleByIntegerLiteral in YogaKit in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftObjectiveC", referenced from:
      __swift_FORCE_LOAD_$_swiftObjectiveC_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftObjectiveC_$_YogaKit)
  "__swift_FORCE_LOAD_$_swiftCoreGraphics", referenced from:
      __swift_FORCE_LOAD_$_swiftCoreGraphics_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftCoreGraphics_$_YogaKit)
  "_swift_getForeignTypeMetadata", referenced from:
      type metadata accessor for __C.YGValue in libYogaKit.a(YGLayoutExtensions.o)
      type metadata accessor for __C.YGUnit in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftFoundation", referenced from:
      __swift_FORCE_LOAD_$_swiftFoundation_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftFoundation_$_YogaKit)
  "associated conformance descriptor for Swift.ExpressibleByFloatLiteral.Swift.ExpressibleByFloatLiteral.FloatLiteralType: Swift._ExpressibleByBuiltinFloatLiteral", referenced from:
      l_got.$ss25ExpressibleByFloatLiteralP0cD4TypeAB_s01_ab7BuiltincD0Tn in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftUIKit", referenced from:
      __swift_FORCE_LOAD_$_swiftUIKit_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftUIKit_$_YogaKit)
  "__swift_FORCE_LOAD_$_swiftMetal", referenced from:
      __swift_FORCE_LOAD_$_swiftMetal_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftMetal_$_YogaKit)
  "Swift.Float.init(Swift.Double) -> Swift.Float", referenced from:
      static (extension in YogaKit):CoreGraphics.CGFloat.% postfix(CoreGraphics.CGFloat) -> __C.YGValue in libYogaKit.a(YGLayoutExtensions.o)
      (extension in YogaKit):__C.YGValue.init(CoreGraphics.CGFloat) -> __C.YGValue in libYogaKit.a(YGLayoutExtensions.o)
  "__swift_FORCE_LOAD_$_swiftDarwin", referenced from:
      __swift_FORCE_LOAD_$_swiftDarwin_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
     (maybe you meant: __swift_FORCE_LOAD_$_swiftDarwin_$_YogaKit)
  "protocol witness table for Swift.Float : Swift._ExpressibleByBuiltinFloatLiteral in Swift", referenced from:
      associated type witness table accessor for Swift.ExpressibleByFloatLiteral.FloatLiteralType : Swift._ExpressibleByBuiltinFloatLiteral in __C.YGValue : Swift.ExpressibleByFloatLiteral in YogaKit in libYogaKit.a(YGLayoutExtensions.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Showing All Errors Only
Undefined symbol: protocol descriptor for Swift.ExpressibleByFloatLiteral
Undefined symbol: associated type descriptor for Swift.ExpressibleByIntegerLiteral.IntegerLiteralType
Undefined symbol: associated conformance descriptor for Swift.ExpressibleByIntegerLiteral.Swift.ExpressibleByIntegerLiteral.IntegerLiteralType: Swift._ExpressibleByBuiltinIntegerLiteral
Undefined symbol: method descriptor for Swift.ExpressibleByFloatLiteral.init(floatLiteral: A.FloatLiteralType) -> A
Undefined symbol: protocol descriptor for Swift.ExpressibleByIntegerLiteral
Undefined symbol: value witness table for Builtin.Int32
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreImage
Undefined symbol: associated type descriptor for Swift.ExpressibleByFloatLiteral.FloatLiteralType
Undefined symbol: __swift_FORCE_LOAD_$_swiftQuartzCore
Undefined symbol: __swift_FORCE_LOAD_$_swiftDispatch
Undefined symbol: method descriptor for Swift.ExpressibleByIntegerLiteral.init(integerLiteral: A.IntegerLiteralType) -> A
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreFoundation
Undefined symbol: protocol witness table for Swift.Int : Swift._ExpressibleByBuiltinIntegerLiteral in Swift
Undefined symbol: __swift_FORCE_LOAD_$_swiftObjectiveC
Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreGraphics
Undefined symbol: _swift_getForeignTypeMetadata
Undefined symbol: __swift_FORCE_LOAD_$_swiftFoundation
Undefined symbol: associated conformance descriptor for Swift.ExpressibleByFloatLiteral.Swift.ExpressibleByFloatLiteral.FloatLiteralType: Swift._ExpressibleByBuiltinFloatLiteral
Undefined symbol: __swift_FORCE_LOAD_$_swiftUIKit
Undefined symbol: __swift_FORCE_LOAD_$_swiftMetal
Undefined symbol: Swift.Float.init(Swift.Double) -> Swift.Float
Undefined symbol: __swift_FORCE_LOAD_$_swiftDarwin
Undefined symbol: protocol witness table for Swift.Float : Swift._ExpressibleByBuiltinFloatLiteral in Swift

Anyone else experiencing the same?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 32
  • Comments: 15 (2 by maintainers)

Most upvoted comments

For my case, I had to exclude arm64 from the architecture by adding it like this in my Podfile :

post_install do |installer| react_native_post_install(installer) installer.pods_project.build_configurations.each do |config| config.build_settings[“EXCLUDED_ARCHS[sdk=iphonesimulator*]”] = “arm64” end end

And specify the flipper version use_flipper!({'Flipper' => '0.79.0'})

Then, I cleaned my pods and reinstalled it : rm -rf ~/Library/Caches/CocoaPods && rm -rf Pods && rm -rf ~/Library/Developer/Xcode/DerivedData/* && pod deintegrate && pod setup && pod install

And now I’m able to build 💯

See https://stackoverflow.com/a/65399525 to understand why we need to exclude arm64

Please people STOP recommending Rosetta so that we can actually find a REAL FIX for this solution 🤦

If anyone is still struggling with this on M1’s, just install Rosetta (softwareupdate –install-rosetta) and then go to Finder > Right click on Xcode > Get info > Enable “Start with Rosetta”. This will make Xcode and respective builds to run correctly and will make it possible to generate Archives and so on, the only opposite side is that it runs slower than normally running.

I followed @alimtunc advice plus: Exclude the arm64 arch in the Build Setting of the project (open xcodeproj on XCode): image

And I did the same for the Pods such a Flipper and YogaKit because the past year I face a similar issue with the arch and I fixed it excluding arm64 from this two Pods.

Version OS: 11.4 (20F71) MacBook Air (M1, 2020)

Xcode: Version 12.5.1 (12E507)

The terminal and XCode are not running with Rosetta. After all of this I was having troubles with Ruby, but there’s thread already opened here that solves that problem.

For anyone having M1 chip issues like this:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_FlipperKitReactPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_SKDescriptorMapper", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RNCPushNotificationIOS", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FlipperClient", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTLinkingManager", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FKUserDefaultsPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTBridge", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTRootView", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FlipperKitNetworkPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_Adjust", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FlipperKitLayoutPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_SKIOSNetworkAdapter", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTBundleURLProvider", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FBSDKApplicationDelegate", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Turning on Open using rosetta on Terminal and running from Terminal (not from vscode) worked for me.

Screenshot 2021-03-10 at 12 59 35

You’ll need rosetta installed

softwareupdate --install-rosetta

Open application > utilities > Terminal. Right click > Get Info > Toggle Open using rosetta

I was able to run without it before, I’m wondering if it’s something to do with Flipper not supporting arm64? 🤔 I can run my code now, it builds a lot slower and my MacBook is pretty hot 🔥 which hasn’t been since I upgrade to an M1 chip.

For anyone struggling to understand the differences between x64 and arm64 this video sheds some light on the difference https://developer.apple.com/videos/play/wwdc2020/10214/.

I have re-runned react-native init with rosseta terminal, the problem is solved, the iOS project is created with the right arch + arm64 excluded.

I combined @alimtunc and @DracotMolver solutions and can confirm that this Podfile’s snipet:

  post_install do |installer|
    react_native_post_install(installer)
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
  end

plus excluding it also in xcodeproj fixes the problem.

The thing that worries me is that after applying it, if I cold start the app on iOS simulator (kill and reopen) I get the

RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks

Warning. Also I’m not sure why we need those fixes because if you looks closely at react_native_post_install which is located at /node_modules/react-native/scripts/react_native_pods.rb. It seems to already exclude the arm64 architecture:

def exclude_architectures(installer)
  projects = installer.aggregate_targets
    .map{ |t| t.user_project }
    .uniq{ |p| p.path }
    .push(installer.pods_project)

  arm_value = `/usr/sbin/sysctl -n hw.optional.arm64 2>&1`.to_i

  # Hermes does not support `i386` architecture
  excluded_archs_default = has_pod(installer, 'hermes-engine') ? "i386" : ""

  projects.each do |project|
    project.build_configurations.each do |config|
      if arm_value == 1 then
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = excluded_archs_default
      else
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 " + excluded_archs_default
      end
    end

    project.save()
  end
end

@alimtunc Thank you! Solved my issues for building for two projects.

Hocam eline sağlık tekrar 😃