rubyxcodereact-nativecocoaapple-m1

React Native M1 Mac build failure with target "React-Codegen"


When I run the command npx react-native run-ios in my terminal on my Mac I receive the error

CompileC /Users/jessicageorge-mannella/Library/Developer/Xcode/DerivedData/AwesomeProject-ctnixtnnzajiwuhfvbyaxlajljew/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Codegen.build/Objects-normal/arm64/FBReactNativeSpec-generated.o /Users/jessicageorge-mannella/Documents/testing/AwesomeProject/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-Codegen' from project 'Pods')
(1 failure)

I'm running react native 0.71.5, ruby version 2.6.10, cocoapods version 1.11.3, node version 18.15.0, Xcode version 14.3 and I tried even re-installing MacOS on my laptop in attempt to delete broken version installs. Here's the full list of my installed packages in relation to react-native as-well as some system information

System:
    OS: macOS 13.3
    CPU: (10) arm64 Apple M1 Pro
    Memory: 150.44 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.15.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 9.6.3 - /usr/local/bin/npm
    Watchman: 2023.03.27.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 14.3/14E222b - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.5 => 0.71.5
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Thanks!


Solution

  • This is a known issue with react-native that was reported on March 31st in the react-native GitHub repository. It is related to incompatibility between Xcode 14.3 and react-native versions prior to v0.71.6.

    v.0.71.6 has been released that resolves the issue by changing the minimum targeted iOS version to 12.4. Prior to this version being released there was a suggested patch that could be applied to v0.71.5.

    And for older versions of react-native (e.g., v0.70.6) a different suggested patch may be applied instead.