如何求解xcode构建错误'架构x86_64'的未定义符号
我试图在模拟器中运行该项目,遇到了一些问题并解决了问题,终于遇到了以下错误,我尝试了许多方法,但是我无法解决。我该如何解决此问题,请给我一些想法,我是iOS开发的新手。
CPU:M1 PRO
系统:MACOS12.3
XCODE:13.4
REECT本地: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
这样做帮助我解决了这个问题:
修改构建设置 - >排除架构选项,添加任何iOS Simulator SDK选项,并将值设置为ARM64.1所示:
并在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/70370370370371201201582694448>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以查看这些链接,也许它们可以提供帮助:
尽管有助于我从react -native 0.64.2
xcode上的库搜索路径中删除这些值的原因是 - >构建设置 - >搜索路径 - >库搜索路径
“ $(toolchain_dir)/usr/lib/swift-5.0/ $(platform_name)”
“ $(toolchain_dir)/usr/usr/lib/swift/$(platform_name)” << /code>
清洁项目和Xcode派生的数据还可以帮助
rm -rf〜/library/developer/xcode/deriveddata
(清洁派生数据)You can view these links maybe they can help:
Although what helped me was removing these values from the library search paths on react-native 0.64.2
Xcode -> Build Settings -> Search Paths -> Library Search Paths
"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"
"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)"
Also cleaning the project and xcode derived data can help also
rm -rf ~/Library/Developer/Xcode/DerivedData
(clean derived data)只需选择产品 - &GT;目的地 - &GT;目标架构 - &GT;展示罗塞塔目的地并重建应用程序
just choose product -> Destination -> Destination architecture -> show rosetta destinations and rebuild the app
我只需要做:
pod install (因为尝试 pod dentegrate 之前)
和重新启动Metro Bundler。
我希望这对你有帮助
I just had to do :
and pod install (because a try pod deintegrate before)
and restart metro bundler.
I hope this will help you
只需在iOS/podfile中评论这一行:
just comment out this lines in iOS/podfile:
编辑中提供的答案是正确的解决方案。要中继线程:
将以下内容添加到您的podfile:
要进行更详细的求解,请阅读此讨论:
The answer provided in the edit is the correct solution. To relay in thread:
Add the following to your Podfile:
For a more detailed solve, read this discussion: Xcode building for iOS Simulator, but linking in an object file built for iOS, for architecture 'arm64'
当我初始化反应生态项目时,我遇到了这个问题。
我正在使用M1 Ventura 13.1。
https:// https://github.com/github.com/face/face/face/react-native/issues/ 35053#issuecomment-1324612311
https:// fek.io/blog/how-to-to-to-to-up-up-react-native-on-m-1-Mac-2022-Edition
之后,这些功能非常适合启动一个React-Native Project!
其中包括有关Ruby安装(使用RBENV)和使用LTS节点等的特定启动。
为了包括详细信息,
I had this problem when I was initializing react-native project.
I'm using M1 Ventura 13.1.
https://github.com/facebook/react-native/issues/35053#issuecomment-1324612311
https://fek.io/blog/how-to-set-up-react-native-on-m-1-mac-2022-edition
Following these worked perfectly on initiating a react-native project!
These include specific insturctions on ruby installation(using rbenv) and using lts node, etc.
To include the details,