react-native: iOS build fails with "_main" undefined for architecture x86_64 after upgrading to React Native 0.78

Description

I’m upgrading a React Native project from 0.68.6 to 0.78.0 and followed all steps on React Native Upgrade Helper.

✅ yarn install and pod install both complete successfully.

❌ But when I try to build the iOS project in Xcode, it fails with the following error:

ld: warning: ignoring duplicate libraries: '-lc++'
ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes'
ld: Undefined symbols for architecture x86_64:
  "_main", referenced from:
    <initial-undefines>
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

🔍 My assumption: it might be failing to find the correct entry point of the app (@main or AppDelegate.swift misconfiguration?).

Environment:

  • macOS 14.7.1 (M3)
  • Xcode 16.1
  • CocoaPods 1.16.2
  • Ruby 2.7.4p191

I’d appreciate help from anyone who’s dealt with similar iOS build issues during a major React Native upgrade. Happy to share more config if needed. Thanks!

Steps to reproduce

  1. Using ReactNative Upgrade Helper to apply all the changes from 0.68.6 to 0.78.0
  2. Removes node_modules, yarn.lock, ios/Pods, ios/Podfile.lock, ios/build, ~/Library/Developer/Xcode/DerivedData
  3. yarn install & pod install successfully
  4. Go to XCode to build, and face the build failed.

React Native Version

0.78.0

Affected Platforms

Build - MacOS, Runtime - iOS

Output of npx @react-native-community/cli info

System:
  OS: macOS 14.7.1
  CPU: (12) arm64 Apple M3 Pro
  Memory: 127.20 MB / 18.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.20.5
    path: ~/.nvm/versions/node/v18.20.5/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v18.20.5/bin/npm
  Watchman:
    version: 2025.03.10.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.3 AI-243.24978.46.2431.13208083
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.26
    path: /opt/homebrew/opt/openjdk@11/bin/javac
  Ruby:
    version: 2.7.4
    path: /Users/pirunseng/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.78.1
    wanted: 0.78.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

info React Native v0.79.0 is now available (your project is running on v0.78.1).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.79.0
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.78.1&to=0.79.0
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".

Stacktrace or Logs

ld: warning: ignoring duplicate libraries: '-lc++'
ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes'
ld: Undefined symbols for architecture x86_64:
  "_main", referenced from:
    <initial-undefines>
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Reproducer

Unfortunately, I cannot share the company’s private repo, but I’ve followed the official Upgrade Helper strictly from 0.68 to 0.78.

Screenshots and Videos

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (1 by maintainers)

Most upvoted comments

No not yet.

I have found the problem… In my case I updated the version of react native and created the AppDelegate.swift in VS, but the problem was that this file was not in xcode… After adding file in xcode the build was successfull

@cortinico No problem. I’m not sure if this has been written in the doc or somewhere. Yet, I just want to share that I have just figured it out and get this worked by adding “AppDelegate.swift” file into XCode project. Not sure if it’s Xcode cache or bug. I’ve found out this when I initiate a new RN0.78 project running on XCode.

@avinashkumar0808 Thanks a lot Bro!!!

No not yet.