14

I have built a react native app that runs fine in android.....but when I try to build in ios I get the following error: Undefined symbols for architecture x86_64 It appears to be linked in some way to flipper, as the detailed errors are as below:

     link with file built for iOS Simulator-arm64
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_FlipperKitNetworkPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FlipperKitReactPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_SKDescriptorMapper", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FlipperClient", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RNCPushNotificationIOS", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FlipperKitLayoutPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTRootView", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTBridge", 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
  "_OBJC_CLASS_$_FIRApp", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FKUserDefaultsPlugin", 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)
james murphy
  • 1,505
  • 5
  • 31
  • 57

1 Answers1

49

I had the same problem on m1, doing this helped me solve the problem:

Modify the Build Settings -> Excluded Architectures option, add the Any iOS Simulator SDK option, and set the value to arm64.As shown in the figure:

enter image description here

and add the following code in Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64"
    end
  end
end
Z Hu
  • 706
  • 1
  • 3
  • 13
  • I love you! thank you so much – Mateo Verdaguer Jan 16 '23 at 05:13
  • Thank you! Changing Podfile did the trick - didn't need the xcode changes part. – MasterPiece May 01 '23 at 23:47
  • I don't understand this — I'm on an M1 mac, so my simulator is running arm64, right? Why would I want to exclude that architecture? For that matter, why is anything for x86_64 getting built at all? – iameli Jun 04 '23 at 20:47
  • 1
    When creating a static library, a version will be packaged separately for the actual device (arm64) and the simulator (x86_64). On Intel Mac, there is no problem with the simulator using x86_64 instructions, but there will be problems on M1 Mac. After excluding the arm64 architecture, the simulator will still run in the arm64 mode, but the app in the simulator runs in the x86 mode. https://juejin.cn/post/7037037120158269448 – Z Hu Jun 06 '23 at 03:26