如何解决xcode构建错误'x86_64体系结构未定义符号'

ewm0tg9j  于 2022-12-05  发布在  其他
关注(0)|答案(2)|浏览(294)

我试着在模拟器中运行这个项目,我遇到了一些问题,并解决了它,我终于得到了下面的错误,我尝试了很多方法,但我不能解决它。我如何才能解决这个问题,请给予我一些想法,我是新的ios开发。
CPU:m1 pro
系统:macOS12.3
xcode :13.4
本地React: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,如图:

并在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引起的

qeeaahzv

qeeaahzv1#

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

虽然帮助我的是从react-native 0.64.2上的库搜索路径中删除这些值
Xcode -〉构建设置-〉搜索路径-〉库搜索路径

  • “$(工具链目录)/usr/lib/swift-5.0/$(平台名称)”
  • “$(工具链目录)/usr/lib/swift/$(平台名称)”

此外,清理项目和xcode派生数据也会有所帮助

  • rm -rf ~/资源库/开发人员/Xcode/衍生数据(清除衍生数据)
  • CMD + K(清除xcode中的项目)
3bygqnnd

3bygqnnd2#

我只是不得不做:

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

和***pod安装***(因为之前尝试***pod解除集成***)
并重新启动Metro捆绑器。
我希望这对你有帮助

相关问题