为什么我的 M1 Mac 上的 Xcode 试图为 `iOS Simulator-x86_64` 构建?为什么不为基于 `arm` 的模拟器构建?

我有一台 M1 MacBook Air。

在 Xcode 中为模拟器构建时,我看到以下警告和错误:

ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/GoogleSignIn.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/AppAuth.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file 
/Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/GTMAppAuth.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/AppAuthCore.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/GTMSessionFetcherCore.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_GIDConfiguration", referenced from:
      objc-class-ref in GlobalState.o
  "_OBJC_CLASS_$_GIDSignIn", referenced from:
      objc-class-ref in GoogleAuthService.o
      objc-class-ref in GoogleRefreshTokenService.o
      objc-class-ref in InvisibleComputersAppApp.o
  "_OBJC_CLASS_$_GIDSignInButton", referenced from:
      objc-class-ref in LoginView.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

这听起来像 Xcode 以某种方式试图构建一个 x86 二进制文件?为什么它甚至试图这样做,不是基于 M1 Macs 的模拟器 arm 吗?

我怎样才能

stack overflow Why is Xcode on my M1 Mac trying to build for `iOS Simulator-x86_64`? Why is it not building for an `arm` based simulator?
原文答案

答案:

作者头像

您可以尝试打开 Xcode 并勾选“使用 Rosetta 打开”。

  1. 退出 Xcode
  2. 转到您的应用程序文件夹
    2.右击Xcode然后选择“获取信息”
    3.勾选“使用Rosetta打开”
    4.打开Xcode

    Open using Rosetta

作者头像

如果您有一个不支持 arm64 的依赖项,您可以通过将“arm64”添加到目标构建设置中的排除架构列表 ( EXCLUDED_ARCHS ) 来告诉构建系统跳过 arm64(此构建 x86_64)。

相关问题