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 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Issue: Author Provided Repro Needs: Triage :mag:
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
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. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用链接的 RNExtensionIssue 复现项目,并在 Xcode 中打开其 iOS .xcworkspace。构建 IntentExt scheme,然后检查 IntentHandler.o 对 RCTRootView 的引用,以及 extension 链接的 pods 和 frameworks。当 IntentExt target 成功链接且不再出现 undefined-symbol 错误时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
ios, react-native
领域
mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。