Skip to content

iOS build fails with "_main" undefined for architecture x86_64 after upgrading to React Native 0.78 #50617

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

Closed
PirunSeng opened this issue Apr 10, 2025 · 13 comments
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Newer Patch Available Platform: iOS iOS applications. Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed.

Comments

@PirunSeng
Copy link

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

@react-native-bot
Copy link
Collaborator

Tip

Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.78.2. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@react-native-bot react-native-bot added Platform: iOS iOS applications. Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Apr 10, 2025
@react-native-bot
Copy link
Collaborator

Tip

Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@react-native-bot
Copy link
Collaborator

Warning

Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

@cortinico cortinico added the Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. label Apr 10, 2025
@react-native-bot
Copy link
Collaborator

Note

Not a bug report: This issue looks like a question. We are using GitHub issues exclusively to track bugs in React Native. GitHub may not be the ideal place to ask a question, but you can try asking over on Stack Overflow, or on Reactiflux.

@cortinico
Copy link
Contributor

We sadly can't help without a proper reproducer or without seeing your code

@PirunSeng
Copy link
Author

@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.

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Apr 11, 2025
@MuhammadRafeh
Copy link

+1

@MuhammadRafeh
Copy link

I'm getting this error

ld: warning: ignoring duplicate libraries: '-lc++' ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found ld: warning: Could not parse or use implicit file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore.tbd': cannot link directly with 'SwiftUICore' because product being built is not an allowed client of it Undefined symbols for architecture arm64: "_main", referenced from: ___debug_main_executable_dylib_entry_point in command-line-aliases-file ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

@avinashkumar0808
Copy link

I'm getting this error

ld: warning: ignoring duplicate libraries: '-lc++' ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found ld: warning: Could not parse or use implicit file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore.tbd': cannot link directly with 'SwiftUICore' because product being built is not an allowed client of it Undefined symbols for architecture arm64: "_main", referenced from: ___debug_main_executable_dylib_entry_point in command-line-aliases-file ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Did you get the answer?

@avinashkumar0808
Copy link

@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.

Please share the solution

@MuhammadRafeh
Copy link

No not yet.

@avinashkumar0808
Copy link

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

@MuhammadRafeh
Copy link

@avinashkumar0808 Thanks a lot Bro!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Newer Patch Available Platform: iOS iOS applications. Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed.
Projects
None yet
Development

No branches or pull requests

5 participants