react / react/react-native

Undefined symbol: _OBJC_CLASS_$_RCTRootView - Linker command failed with exit code 1 (use -v to see invocation)

Open
#44,749 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Author Provided Repro Needs: Triage :mag:
Dominant language
C++
Stars
127k
Forks
25.3k
Avg merge
1d 23h
Merged PRs (30d)
4

Description

Description

I am trying to create Intent Extension but encountering an issue when building my project where the linker command fails with the following error message:

Showing All Issues
Undefined symbol: OBJC_CLASS$_RCTRootView
Linker command failed with exit code 1 (use -v to see invocation)

Steps to reproduce
  1. Clone the repository and navigate to the project directory.
  2. Run yarn
  3. Open the .xcworkspace file in Xcode.
  4. Select the extension scheme and build target.
  5. Attempt to build the project using Xcode.
React Native Version

0.74.1, & 0.72.4,

Affected Platforms

Runtime - iOS

Output of npx react-native info
System:
  OS: macOS 14.4.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 822.47 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.9.0
    path: ~/.nvm/versions/node/v20.9.0/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.nvm/versions/node/v20.9.0/bin/yarn
  npm:
    version: 10.1.0
    path: ~/.nvm/versions/node/v20.9.0/bin/npm
  Watchman:
    version: 2024.03.25.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/ahmed.quraishi/.rvm/gems/ruby-3.0.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
    Build Tools:
      - 29.0.2
      - 30.0.3
      - 33.0.0
      - 34.0.0
    System Images:
      - android-29 | Google APIs ARM 64 v8a
      - android-30 | Google APIs ARM 64 v8a
      - android-31 | Google APIs ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
      - android-33 | Google TV ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11076708
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 3.0.0
    path: /Users/ahmed.quraishi/.rvm/rubies/ruby-3.0.0/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.1
    wanted: 0.74.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
Stacktrace or Logs
Showing All Errors Only

Build target IntentExt of project extension with configuration Debug

Ld /Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Products/Debug-iphonesimulator/IntentExt.appex/IntentExt normal (in target 'IntentExt' from project 'extension')
    cd /Users/ahmed.quraishi/Desktop/Projects/extension/ios
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Xlinker -reproducible -target arm64-apple-ios17.4-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.4.sdk -O0 -L/Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphonesimulator -L/Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Products/Debug-iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.4.sdk/usr/lib/swift -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -F/Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphonesimulator -F/Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Products/Debug-iphonesimulator -F/Users/ahmed.quraishi/Desktop/Projects/extension/ios/Pods/hermes-engine/destroot/Library/Frameworks/universal -F/Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/hermes-engine/Pre-built -filelist /Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Intermediates.noindex/extension.build/Debug-iphonesimulator/IntentExt.build/Objects-normal/arm64/IntentExt.LinkFileList -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/../../Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Intermediates.noindex/extension.build/Debug-iphonesimulator/IntentExt.build/Objects-normal/arm64/IntentExt_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -e _NSExtensionMain -fapplication-extension -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Intermediates.noindex/extension.build/Debug-iphonesimulator/IntentExt.build/Objects-normal/arm64/IntentExt.swiftmodule -lc++ -lc++abi -licucore -framework Accelerate -framework AudioToolbox -framework CFNetwork -framework JavaScriptCore -framework MobileCoreServices -framework Security -framework UIKit -framework hermes -ObjC -lc++ -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Intermediates.noindex/extension.build/Debug-iphonesimulator/IntentExt.build/IntentExt.appex-Simulated.xcent -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __ents_der -Xlinker /Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Intermediates.noindex/extension.build/Debug-iphonesimulator/IntentExt.build/IntentExt.appex-Simulated.xcent.der -framework PassKit -lPods-IntentExt -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Intermediates.noindex/extension.build/Debug-iphonesimulator/IntentExt.build/Objects-normal/arm64/IntentExt_dependency_info.dat -o /Users/ahmed.quraishi/Library/Developer/Xcode/DerivedData/extension-hambbgmbepieztcxuctphmpiupmc/Build/Products/Debug-iphonesimulator/IntentExt.appex/IntentExt

ld: warning: ignoring duplicate libraries: '-lc++'
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_RCTRootView", referenced from:
       in IntentHandler.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Undefined symbol: _OBJC_CLASS_$_RCTRootView

Linker command failed with exit code 1 (use -v to see invocation)



Build failed 
Reproducer

https://github.com/AhmadQuraishi/RNExtensionIssue.git

Screenshots and Videos
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the linked RNExtensionIssue reproducer and open its iOS .xcworkspace in Xcode. Build the IntentExt scheme, then inspect the IntentHandler.o reference to RCTRootView and the extension's linked pods and frameworks. Done means the IntentExt target links successfully without the undefined-symbol error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.