React Native M1 Mac build failure with target "React-Codegen"
Asked Answered
E

4

6

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!

Execrative answered 2/4, 2023 at 2:28 Comment(3)
Did you installed pods under Rosetta or with a command prefix ?Therron
I have RN 0.71.4 with ruby 2.7.6 and I can run my commands without Rosetta with success. I installed ruby with ruby-install and chruby as version managerTherron
From RN 0.71.5 there is no more committed .ruby-version as you can see in the changelog but the doc still mention that 2.7.6 is required for this version. I'm not sure that this cause the issue but I would recommend to install a ruby version manager. From my experience this one is the less buggy: moncefbelyamani.com/…Therron
G
8

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.

Grano answered 3/4, 2023 at 20:59 Comment(0)
S
10

Quick Fix: Go to Pods -> Select React-Codegen from Build Settings and update iOS Deployment Target to iOS 12.4.

pods build settings

Stable Fix: Refer https://github.com/travis-mark/lrn/commit/015854716feadd61a904d5a603b027426472f863

Singular answered 5/5, 2023 at 6:19 Comment(3)
what are the drawbacks using this quick fix instead of upgrading RN?Degrease
Bless you bless you a million timesBareilly
Anything above 12.+ will workScrutator
G
8

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.

Grano answered 3/4, 2023 at 20:59 Comment(0)
V
1

This can simply be solved by changing the minimum ios version of ReactCodegen inside Xcode targets to 12.0 or greater.

I was facing this issue and I got out of it with this fix.

Vice answered 6/4, 2023 at 19:11 Comment(0)
M
1

my error was caused because i had a folder with space between name in my my projects file directory.

Magnetron answered 17/7, 2024 at 6:7 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.