react / react/react-native

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

オープン
#44,749 コメント 0 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Issue: Author Provided Repro Needs: Triage :mag:
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンクされた RNExtensionIssue の再現用プロジェクトを使用し、その iOS .xcworkspace を Xcode で開きます。IntentExt スキームをビルドし、IntentHandler.o から RCTRootView への参照と、エクステンションにリンクされている pods および frameworks を確認します。IntentExt ターゲットが undefined-symbol エラーなしで正常にリンクできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
ios, react-native
領域
mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。