【问题标题】: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?为什么我的 M1 Mac 上的 Xcode 试图为“iOS Simulator-x86_64”构建?为什么不为基于“arm”的模拟器构建?
【发布时间】:2021-10-31 12:59:07
【问题描述】:

我有一台 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 吗?

我该怎么做

【问题讨论】:

  • 检查项目设置和 .xcconfig 文件 - 可能有 x86_64 架构集。
  • @Asperi 这会是什么样子?
  • 在“架构”下显示“标准架构 (arm64, armv7) - $(ARCHIS STANDARD)
  • 嘿@Asperi - 是的,我找到了一个设置。由于其他一些问题,我之前一直在关注堆栈溢出答案以禁用模拟器的 ARM 构建......现在切换到 M1 Mac 后,这让我很痛苦。
  • 得到了同样的结果。你发现了吗?

标签: swift xcode apple-m1


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-06
    • 2015-08-10
    • 2022-01-19
    • 2021-12-16
    • 2021-05-04
    • 2021-01-08
    • 2021-12-22
    • 2011-01-21
    相关资源
    最近更新 更多