Why does command 'react-native run-ios' build fail after upgrade to 0.63.3?

Jim picture Jim · Nov 9, 2020 · Viewed 8.7k times · Source

I just updated to RN v0.63.3. I was having issues with react-native run-ios on previous react-native version after changing the name of the app, and the project/schemes had different names, never got that issue solved, everyone said to just upgrade.

now on v0.63.3 there is still an issue with failing build after react-native run-ios. this time the error is:

** BUILD FAILED **

The following build commands failed: CompileC /Users/vorousjames/Library/Developer/Xcode/DerivedData/<OLD_NAME>-gdmnlxiprekjqhfiueouiidqhqnl/Build/Intermediates.noindex/<NEW_NAME>.build/Debug-iphonesimulator/<NEW_NAME>.build/Objects-normal/x86_64/AppDelegate.o /Users/Desktop/Development/App/iOS/<OLD_NAME>/AppDelegate.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure)

There is NO issue building/running from inside Xcode. ONLY with react-native run-ios

EDIT: I thought maybe there was an issue with the fact that I had the cli globally installed since I was just calling react-native run-ios. I believe that uses the global installation. so since its outdated, I uninstalled globally and tried to use the community package with npx react-native run-ios. now its giving another comileC error, but different.

** BUILD FAILED **

The following build commands failed: CompileC /Users/Library/Developer/Xcode/DerivedData/App-gdmnlxiprekjqhfiueouiidqhqnl/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNFirebase.build/Objects-normal/x86_64/RNFirebaseMessaging.o /Users/Desktop/Development/App/node_modules/react-native-firebase/ios/RNFirebase/messaging/RNFirebaseMessaging.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler CompileC /Users/Library/Developer/Xcode/DerivedData/App-gdmnlxiprekjqhfiueouiidqhqnl/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNFirebase.build/Objects-normal/x86_64/RNFirebaseFirestore.o /Users/Desktop/Development/App/node_modules/react-native-firebase/ios/RNFirebase/firestore/RNFirebaseFirestore.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (2 failures)

This is completely killing my ability to iterate quickly, any advice is welcomed

react-native: 0.63.3 react-native-cli (global): 2.0.1 react-native-community/cli: ^4.8.0 Xcode: 12.0.1 iOS: 14.0.1

UPDDATE:

package.json:

{
    "name": "Aflare",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "android": "react-native run-android",
        "ios": "react-native run-ios",
        "start": "react-native start",
        "test": "jest",
        "lint": "eslint ."
    },
    "dependencies": {
        "@react-native-community/cli": "^4.8.0",
        "@react-native-community/clipboard": "^1.2.2",
        "algoliasearch": "^3.16.0",
        "appcenter": "3.1.1",
        "appcenter-analytics": "3.1.1",
        "appcenter-crashes": "3.1.1",
        "axios": "^0.19.2",
        "moment": "^2.24.0",
        "moment-timezone": "^0.5.27",
        "prop-types": "^15.7.2",
        "react": "^16.13.1",
        "react-native": "^0.63.3",
        "react-native-agora": "^3.1.3",
        "react-native-algolia-dropdown": "^1.6.0",
        "react-native-calendars": "^1.220.0",
        "react-native-chart-kit": "^4.3.0",
        "react-native-code-push": "^6.0.0",
        "react-native-extended-stylesheet": "^0.12.0",
        "react-native-firebase": "^5.6.0",
        "react-native-gesture-handler": "^1.5.2",
        "react-native-image-crop-picker": "^0.26.1",
        "react-native-material-dropdown": "^0.11.1",
        "react-native-reanimated": "^1.4.0",
        "react-native-responsive-screen": "^1.4.1",
        "react-native-safe-area-context": "^0.6.2",
        "react-native-screens": "^1.0.0-alpha.23",
        "react-native-snap-carousel": "^3.8.4",
        "react-native-splash-screen": "^3.2.0",
        "react-native-svg": "^9.13.6",
        "react-native-view-shot": "^3.1.2",
        "react-native-webview": "^9.4.0",
        "react-navigation": "^4.0.2",
        "react-navigation-drawer": "^2.3.3",
        "react-navigation-stack": "^1.10.3",
        "react-redux": "^7.1.3",
        "redux": "^4.0.4",
        "redux-persist": "^6.0.0",
        "redux-thunk": "^2.3.0",
        "rn-fetch-blob": "^0.11.2"
    },
    "devDependencies": {
        "@babel/core": "7.8.4",
        "@babel/runtime": "7.8.4",
        "@react-native-community/eslint-config": "1.1.0",
        "@types/react": "^16.9.46",
        "@types/react-dom": "^16.9.8",
        "babel-jest": "^25.1.0",
        "eslint": "6.7.2",
        "jest": "^25.1.0",
        "metro-react-native-babel-preset": "0.59.0",
        "react-test-renderer": "16.13.1"
    },
    "jest": {
        "preset": "react-native"
    }
}

After @Florin's suggestion/process, there are now 14 build errors (from building with npx react-native run-ios):

** BUILD FAILED **

The following build commands failed: CompileSwift normal x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/BeanCovertor.swift CompileSwift normal x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/Callback.swift CompileSwift normal x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/Extensions.swift CompileSwift normal x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/MediaObserver.swift CompileSwift normal x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/React/PromiseCallback.swift CompileSwift normal x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/React/RCTAgoraRtcChannelModule.swift CompileSwift normal x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/React/RCTAgoraRtcEngineModule.swift CompileSwift normal x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/React/RCTAgoraRtcSurfaceViewManager.swift CompileSwift normal x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/RtcChannel.swift CompileSwift normal x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/RtcChannelEvent.swift CompileSwift normal x86_64 /Users/Desktop/Development/Slide/Slide/node_modules/react-native-agora/ios/RCTAgora/Base/RtcEngine.swift CompileSwift normal x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/RtcEngineEvent.swift CompileSwift normal x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/RtcSurfaceView.swift CompileC /Users/Library/Developer/Xcode/DerivedData/<Old_App_Name>-gdmnlxiprekjqhfiueouiidqhqnl/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNFirebase.build/Objects-normal/x86_64/RNFirebaseMessaging.o /Users/Desktop/Development/App/node_modules/react-native-firebase/ios/RNFirebase/messaging/RNFirebaseMessaging.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (14 failures)

the full build output, as far as it goes back in viscose's terminal is here: https://pastebin.com/XenEszNe

Xcode BuildPhases: enter image description here

Answer

Florin Dobre picture Florin Dobre · Nov 12, 2020

Most of the times when I get different outputs from console build and Xcode build I suspect a caching issue and I use next steps to fix the problem:

  • stop JS server
  • remove derived data in Xcode
  • run pod install
  • re-install node_modules (optional)
  • npx watchman watch-del-all && yarn start --reset-cache
  • build using console and build using Xcode

At this point you should have same output from both commands. If you get an error read the entire error message carefully, there are plenty of chances to notice an issue with a module hidden deep in the error log.

Taking a close look at your error message it looks like something related to either derived data/cache or some pods that are not updated.

If you still encounter issue please attach to your question:

  • package.json content,
  • a full error message and
  • content of Xcode->BuildPhases bundle react-native code and images script.

UPDATE:

If after upgrade to 0.63.3 you notice many issues related to React dependencies make sure the pod file is clean and contains only your special dependencies (the ones that do not support automatic linking or the ones for which their documentation specifies they need to be added to the Podfile) and not including the React ones. It should look like this:

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

platform :ios, '10.0'

target 'YourRnApp' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

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

  # Enables Flipper.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'YourRnApp-tvOS' do
  # Pods for RnDiffApp-tvOS

  target 'RnDiffApp-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

More info here:

https://react-native-community.github.io/upgrade-helper/?from=0.61.5&to=0.63.3

After a cleanup of the Podfile, clean cache, run a pod install and rebuild.

At this moment most of the errors should be gone.

Check in Xcode any remaining manual library link that is not needed and remove it (the ones that support auto-linking) and rebuild again.

If still not working check the project.pbxproj in the RN upgrade helper.

Take the errors one by one. Most of them should be fixable using the RN upgrade helper and other Stackoverflow answers.