如何解决xcode构建错误'Undefined symbols for architecture x86_64'

sxissh06  于 2023-08-07  发布在  其他
关注(0)|答案(3)|浏览(303)

我尝试在模拟器中运行该项目,我遇到了一些问题并解决了它,我终于得到了以下错误,我尝试了很多方法,但我不能解决它。我该如何解决这个问题,请给予我一些想法,我是新的ios开发。
CPU:M1 Pro
系统:macOS12.3
xcode:13.4
react native:0.62.2
以下是错误消息:

Showing Recent Errors Only

Build target tolernPowerBankApp of project demo with configuration Debug

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_OIDURLQueryComponent", referenced from:
      objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
  "_OBJC_CLASS_$_GTMSessionFetcher", referenced from:
      objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
  "_OBJC_CLASS_$_OIDAuthorizationRequest", referenced from:
      objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
  "_OIDResponseTypeCode", referenced from:
      -[GIDSignIn authenticateInteractivelyWithOptions:] in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
  "_OBJC_CLASS_$_OIDAuthState", referenced from:
      objc-class-ref in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
      objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
  "_OBJC_CLASS_$_OIDAuthorizationService", referenced from:
      objc-class-ref in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
      objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
  "_OIDOAuthErrorResponseErrorKey", referenced from:
      +[GIDAuthentication handleTokenFetchEMMError:completion:] in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
  "_OBJC_CLASS_$_SKDescriptorMapper", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_GTMAppAuthFetcherAuthorization", referenced from:
      _OBJC_CLASS_$_GTMAppAuthFetcherAuthorizationWithEMMSupport in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
      objc-class-ref in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
      objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
      objc-class-ref in GoogleSignIn(GIDAuthStateMigration_bdf842e92d17b12b5f020e0e721bd017.o)
     (maybe you meant: _OBJC_CLASS_$_GTMAppAuthFetcherAuthorizationWithEMMSupport, _OBJC_CLASS_$_GTMAppAuthFetcherAuthorizationEMMChainedDelegate )
  "_OBJC_METACLASS_$_GTMAppAuthFetcherAuthorization", referenced from:
      _OBJC_METACLASS_$_GTMAppAuthFetcherAuthorizationWithEMMSupport in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
     (maybe you meant: _OBJC_METACLASS_$_GTMAppAuthFetcherAuthorizationWithEMMSupport, _OBJC_METACLASS_$_GTMAppAuthFetcherAuthorizationEMMChainedDelegate )
  "_OBJC_CLASS_$_OIDIDToken", referenced from:
      objc-class-ref in GoogleSignIn(GIDGoogleUser_2bdd4a676c033bc6ca21970e75d9159c.o)
      objc-class-ref in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
      objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
  "_OBJC_CLASS_$_OIDServiceConfiguration", referenced from:
      objc-class-ref in GoogleSignIn(GIDSignIn_f05654be6d1b2af59ab6df426a0c4eb9.o)
  "_OBJC_CLASS_$_FIRApp", referenced from:
      objc-class-ref in AppDelegate.o
  "_RCTRegisterModule", referenced from:
      +[SignWithApple load] in SignWithApple.o
  "_OBJC_CLASS_$_RNCPushNotificationIOS", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTConvert", referenced from:
      __OBJC_$_CATEGORY_RCTConvert_$_GIDSignInButtonStyle in AppDelegate.o
      __OBJC_$_CATEGORY_RCTConvert_$_GIDSignInButtonColorScheme in AppDelegate.o
  "_OIDOAuthTokenErrorDomain", referenced from:
      ___46-[GIDAuthentication refreshTokensWithHandler:]_block_invoke in GoogleSignIn(GIDAuthentication_7b83cc27af8929ec7e4c9760d73a0f31.o)
  "_OBJC_CLASS_$_FlipperKitNetworkPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FlipperKitReactPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTViewManager", referenced from:
      _OBJC_CLASS_$_SignWithApple in SignWithApple.o
  "_OBJC_CLASS_$_FlipperClient", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_GTMOAuth2KeychainCompatibility", referenced from:
      objc-class-ref in GoogleSignIn(GIDAuthStateMigration_bdf842e92d17b12b5f020e0e721bd017.o)
  "_OBJC_CLASS_$_RCTLinkingManager", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FKUserDefaultsPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_GTMKeychain", referenced from:
      objc-class-ref in GoogleSignIn(GIDAuthStateMigration_bdf842e92d17b12b5f020e0e721bd017.o)
  "_OBJC_CLASS_$_RCTBridge", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTRootView", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_METACLASS_$_RCTViewManager", referenced from:
      _OBJC_METACLASS_$_SignWithApple in SignWithApple.o
  "_OBJC_CLASS_$_FlipperKitLayoutPlugin", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_SKIOSNetworkAdapter", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_RCTBundleURLProvider", referenced from:
      objc-class-ref in AppDelegate.o
  "_RCTConvertEnumValue", referenced from:
      +[RCTConvert(GIDSignInButtonStyle) GIDSignInButtonStyle:] in AppDelegate.o
      +[RCTConvert(GIDSignInButtonColorScheme) GIDSignInButtonColorScheme:] in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Build failed    2022/5/23, 14:06    140.1 seconds

字符串
这样做帮助我解决了这个问题:
修改Build Settings -> Excluded Architectures选项,增加Any iOS Simulator SDK选项,设置值为arm 64,如图所示:x1c 0d1x的数据
并在Podfile中添加以下代码:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64"
    end
  end
end


这个问题似乎是由M1引起的。https://juejin.cn/post/7037037120158269448

rqcrx0a6

rqcrx0a61#

您可以查看这些链接,也许他们可以帮助:

尽管帮助我的是从react-native 0.64.2的库搜索路径中删除了这些值
Xcode -> Build Settings -> Search Paths -> Library Search Paths

  • 第一个月
  • "$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)"

清理项目和Xcode派生的数据也会有所帮助

  • rm -rf ~/Library/Developer/Xcode/DerivedData(干净导出数据)
    *CMD + K(来自xcode的Clean Project)
5uzkadbs

5uzkadbs2#

我只需要做:

rm -rf ~/Library/Developer/Xcode/DerivedData/*

字符串
pod install(因为之前尝试了 *pod disintegrate *)
重启Metro Bundler
希望这对你有帮助

brtdzjyr

brtdzjyr3#

我在初始化react-native项目时遇到了这个问题。
我用的是M1 Ventura 13.1
https://github.com/facebook/react-native/issues/35053#issuecomment-1324612311 www.example.com
遵循这些方法可以完美地启动一个react-native项目!其中包括关于ruby安装(使用rbenv)和使用lts node等的具体说明。
包括细节,
1.守望者,椰子都安装了自制软件。

  1. ruby与rbenv一起安装,之后版本存储在~/.ruby-version中

相关问题