Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android working fine but iOS returns an error regarding React-Codegen from project Pods #34651

Closed
vikrvm opened this issue Sep 10, 2022 · 12 comments
Labels
Needs: Triage 🔍 Platform: Android Android applications. Platform: iOS iOS applications. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@vikrvm
Copy link

vikrvm commented Sep 10, 2022

Description

iOS was working fine until this error appeared:

warning: Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyApp' from project 'MyApp')
warning: Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyApp' from project 'MyApp')

** BUILD FAILED **


The following build commands failed:
        CompileC /Users/vikrampal/Library/Developer/Xcode/DerivedData/MyApp-diuniyvicjdzntehptyxnobhkeju/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Codegen.build/Objects-normal/arm64/ShadowNodes.o /Users/vikrampal/Development/react-native/MyApp/ios/build/generated/ios/react/renderer/components/rncore/ShadowNodes.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-Codegen' from project 'Pods')
(1 failure)

Not sure why this occurred after hours of working, but I can't seem to find a solution. I did come across this page that outlines what to do for versions for >0.69.0

https://fbflipper.com/docs/getting-started/react-native/

Version

0.70.0

Output of npx react-native info

System:
OS: macOS 13.0
CPU: (10) arm64 Apple M1 Max
Memory: 1.26 GB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.9.0 - /opt/homebrew/bin/node
Yarn: 1.22.18 - ~/.yarn/bin/yarn
npm: 8.19.1 - /opt/homebrew/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.3 - /Users/vikrampal/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8815526
Xcode: 14.0/14A309 - /usr/bin/xcodebuild
Languages:
Java: 18.0.2 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: 0.70.0 => 0.70.0
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

Running yarn ios --simulator="iPhone 14 Pro Max"

Snack, code example, screenshot, or link to a repository

Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '13.0'
install! 'cocoapods', :deterministic_uuids => false

target 'MyApp' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => FlipperConfiguration.enabled(["Debug"], { 'Flipper' => '0.159.0' }),
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'MyAppTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end
@vikrvm vikrvm added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Sep 10, 2022
@react-native-bot react-native-bot added Platform: Android Android applications. Platform: iOS iOS applications. labels Sep 10, 2022
@vikrvm
Copy link
Author

vikrvm commented Sep 10, 2022

I figured it actually by digging through another thread, from the root of your project run the following. Cheers.

cd ios && RCT_NEW_ARCH_ENABLED=1 pod install

Edit: When you add a package to your project and need to run a pod install, use the command above so the new arch stays enabled. Otherwise, you will return to your error state until you run it again. Just a heads up.

@vikrvm vikrvm closed this as completed Sep 10, 2022
@Lurtroxx
Copy link

Oh my god @mypalvikram I want to wish you a happy new year coming up, thank you so much. You have saved me after 4.5 hours of debugging.

Thank you!

@medobarakat
Copy link

didnt work with me

@Egzscure
Copy link

I figured it actually by digging through another thread, from the root of your project run the following. Cheers.

cd ios && RCT_NEW_ARCH_ENABLED=1 pod install

Edit: When you add a package to your project and need to run a pod install, use the command above so the new arch stays enabled. Otherwise, you will return to your error state until you run it again. Just a heads up.

hi, i just wanted to say thank you and i wanted to give you a small donation but was unable to find a link.

After about 20 hours searching for wtf was happening with the project im trying to build for iOS, your answer was the answer i needed, i tried a 100 thousand things.

thankyou and i hope someday iOS rots in hell.

@vikrvm
Copy link
Author

vikrvm commented Mar 31, 2023

I figured it actually by digging through another thread, from the root of your project run the following. Cheers.
cd ios && RCT_NEW_ARCH_ENABLED=1 pod install
Edit: When you add a package to your project and need to run a pod install, use the command above so the new arch stays enabled. Otherwise, you will return to your error state until you run it again. Just a heads up.

hi, i just wanted to say thank you and i wanted to give you a small donation but was unable to find a link.

After about 20 hours searching for wtf was happening with the project im trying to build for iOS, your answer was the answer i needed, i tried a 100 thousand things.

thankyou and i hope someday iOS rots in hell.

Hey, thank you for the gesture! But it's totally fine I'm glad I was able to help! ❤️

@AbreezaSaleem
Copy link

@mypalvikram thanks for sharing the solution. Sadly it didn't work for me. I feel like I'm on the right track but I might be missing something minor. Can you please help me out?

Here are the logs i get after running the command you shared:

Using firebase.json from '/Users/username/Desktop/appDir/firebase.json'
Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
Auto-linking React Native modules for target `AppName`: BVLinearGradient, Expo, RCTSystemSetting, RNAudioRecorderPlayer, RNCAsyncStorage, RNCClipboard, RNCMaskedView, RNCPushNotificationIOS, RNDefaultPreference, RNDeviceInfo, RNExitApp, RNFBApp, RNFBMessaging, RNFS, RNGestureHandler, RNKeychain, RNNotifee, RNPermissions, RNReanimated, RNSVG, RNScreens, RNShare, RNSoundPlayer, RNUserDefaults, intercom-react-native, jail-monkey, react-native-blob-util, react-native-camera, react-native-cookies, react-native-document-picker, react-native-flipper, react-native-geolocation-service, react-native-image-picker, react-native-image-resizer, react-native-maps, react-native-netinfo, react-native-pdf, react-native-progress-bar-android, react-native-progress-view, react-native-render-html, react-native-safe-area-context, react-native-select-contact, react-native-slider, react-native-splash-screen, react-native-video, and react-native-webview
Using Expo modules
Setting USE_CODEGEN_DISCOVERY=1
[Codegen] Adding script_phases to React-Codegen.
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
[Codegen] Processing react-native core libraries
[Codegen] Found react-native


[Codegen] >>>>> Searching for codegen-enabled libraries in /Users/username/Desktop/appDir/node_modules
[Codegen] Found react-native-gesture-handler
[Codegen] Found react-native-safe-area-context
[Codegen] Found react-native-screens


[Codegen] >>>>> Searching for codegen-enabled libraries in the app


[Codegen] >>>>> Processing FBReactNativeSpec
[Codegen] Generated schema: /var/folders/45/bnxr8njs51n5nqyfy11cjmyw0000gn/T/FBReactNativeSpec21gz0n/schema.json
[Codegen] Generated artifacts: /Users/username/Desktop/appDir/ios/build/generated/ios/FBReactNativeSpec


[Codegen] >>>>> Processing rncore
[Codegen] Generated schema: /var/folders/45/bnxr8njs51n5nqyfy11cjmyw0000gn/T/rncoreniY7Q0/schema.json
[Codegen] Generated artifacts: /Users/username/Desktop/appDir/ios/build/generated/ios/react/renderer/components/rncore


[Codegen] >>>>> Processing rngesturehandler
[Codegen] Generated schema: /var/folders/45/bnxr8njs51n5nqyfy11cjmyw0000gn/T/rngesturehandler8KIHfw/schema.json
[Codegen] Generated artifacts: /Users/username/Desktop/appDir/ios/build/generated/ios/react/renderer/components/rngesturehandler


[Codegen] >>>>> Processing SafeAreaContextSpec
[Codegen] Generated schema: /var/folders/45/bnxr8njs51n5nqyfy11cjmyw0000gn/T/SafeAreaContextSpecTO3TMh/schema.json
[Codegen] Generated artifacts: /Users/username/Desktop/appDir/ios/build/generated/ios/SafeAreaContextSpec


[Codegen] >>>>> Processing safeareacontext
[Codegen] Generated schema: /var/folders/45/bnxr8njs51n5nqyfy11cjmyw0000gn/T/safeareacontexttXqSnJ/schema.json
[Codegen] Generated artifacts: /Users/username/Desktop/appDir/ios/build/generated/ios/react/renderer/components/safeareacontext


[Codegen] >>>>> Processing rnscreens
[Codegen] Generated schema: /var/folders/45/bnxr8njs51n5nqyfy11cjmyw0000gn/T/rnscreensJTvd0I/schema.json
[Codegen] Generated artifacts: /Users/username/Desktop/appDir/ios/build/generated/ios/react/renderer/components/rnscreens


>>>>> Creating component provider
Generated schema list: /var/folders/45/bnxr8njs51n5nqyfy11cjmyw0000gn/T/rn-tmp-schema-list.json
Generated provider in: /Users/username/Desktop/appDir/ios/build/generated/ios


[Codegen] Done.
Pull request detected: null
Analyzing dependencies
RNFBApp: Using overridden static_framework value of 'true'
RNFBMessaging: Using overridden static_framework value of 'true'
Downloading dependencies
Generating Pods project
/Users/username/Desktop/appDir/ios/Pods/Target Support Files/Pods-AppName/Pods-AppName.release.xcconfig
/Users/username/Desktop/appDir/ios/Pods/Target Support Files/Pods-AppName/Pods-AppName.debug.xcconfig
/Users/username/Desktop/appDir/ios/Pods/Target Support Files/Pods-AppName-AppNameTests/Pods-AppName-AppNameTests.release.xcconfig
/Users/username/Desktop/appDir/ios/Pods/Target Support Files/Pods-AppName-AppNameTests/Pods-AppName-AppNameTests.debug.xcconfig
Setting REACT_NATIVE build settings
Integrating client project
expo_patch_react_imports! took 0.1606 seconds to transform
files.
Pod installation complete! There are 126 dependencies from the Podfile and 125 total pods installed.

[!] [Codegen] warn: using experimental new codegen integration

[!] Can't merge user_target_xcconfig for pod targets: ["RNReanimated", "React-RCTFabric", "hermes-engine"]. Singular build setting CLANG_CXX_LANGUAGE_STANDARD has different values.

[!] Can't merge user_target_xcconfig for pod targets: ["RNReanimated", "React-RCTFabric", "hermes-engine"]. Singular build setting CLANG_CXX_LANGUAGE_STANDARD has different values.

[!] Can't merge user_target_xcconfig for pod targets: ["RNReanimated", "React-RCTFabric", "hermes-engine"]. Singular build setting CLANG_CXX_LANGUAGE_STANDARD has different values.

[!] Can't merge user_target_xcconfig for pod targets: ["RNReanimated", "React-RCTFabric", "hermes-engine"]. Singular build setting CLANG_CXX_LANGUAGE_STANDARD has different values.

@vikrvm
Copy link
Author

vikrvm commented Apr 4, 2023

@AbreezaSaleem What version of RN are you using? When I first posted this it was before many changes and updates so I can help check if that still applies.

@AbreezaSaleem
Copy link

@mypalvikram i am using "react-native": "0.69.5"

@AbreezaSaleem
Copy link

AbreezaSaleem commented Apr 4, 2023

Was able to fix my error following the steps mentioned here: #34106 (comment)

Edit: found the actual fix. Apparently, the error was getting caused after an update to XCode to 14.3.0. More details can be found here: #36759. You need to update react-native to 0.70.8 to fix the issue.

@johnchiout
Copy link

I figured it actually by digging through another thread, from the root of your project run the following. Cheers.

cd ios && RCT_NEW_ARCH_ENABLED=1 pod install

Edit: When you add a package to your project and need to run a pod install, use the command above so the new arch stays enabled. Otherwise, you will return to your error state until you run it again. Just a heads up.

I figured it actually by digging through another thread, from the root of your project run the following. Cheers.
cd ios && RCT_NEW_ARCH_ENABLED=1 pod install
Edit: When you add a package to your project and need to run a pod install, use the command above so the new arch stays enabled. Otherwise, you will return to your error state until you run it again. Just a heads up.

Hello, I have the same issue but when I try to run the command I get the following error:

!] Invalid Podfile file:
[!] Invalid RNReanimated.podspec file: [react-native-reanimated] Reanimated 2.x does not support Fabric. Please upgrade to 3.x to use Reanimated with the New Architecture. For details, see https://blog.swmansion.com/announcing-reanimated-3-16167428c5f7.

I cannot update React-reanimated though because other dependencies will break:
any thoughts on that will be appreciated:

@abhimanusharma
Copy link

I figured it actually by digging through another thread, from the root of your project run the following. Cheers.

cd ios && RCT_NEW_ARCH_ENABLED=1 pod install

Edit: When you add a package to your project and need to run a pod install, use the command above so the new arch stays enabled. Otherwise, you will return to your error state until you run it again. Just a heads up.

Resolved my iOS building app.

@sravanvudem
Copy link

mac apple m2 pro sonoma 14.4.1
device apple 15pro
ios 17.2
xcode 15.2/15.4
build failed with Command PhaseScriptExecution failed with a nonzero exit code in xcode and

in terminal
explicit dependency on target 'React-Codegen' in stopped when running ios emulator in react native

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Platform: Android Android applications. Platform: iOS iOS applications. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

9 participants