Kon*_*ert 15 xcode swift apple-m1
我有一台 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)
Run Code Online (Sandbox Code Playgroud)
在我看来,Xcode 正在尝试构建 x86 二进制文件?为什么它甚至试图这样做,模拟器不是arm基于 M1 Mac 的吗?
我怎么能够
我在这个问题上折腾了三天。今天终于破解了,明白了问题所在。
我正在开发一个包含约 100 个框架的高度模块化项目。从 X86_64 (Intel) 架构迁移到 arm64 (M1) 时,我总是收到此错误:
Could not find module 'MyModule' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator, at /my/path/
Run Code Online (Sandbox Code Playgroud)
在 M1 上本地构建时。
原因是模拟器在 M1 上本机运行,但模拟的应用程序仍在 Intel 下运行。这就是为什么首先构建 x86_64 架构的原因。
这两种架构现在正在互相竞争,因为模拟器是arm64,而模拟应用程序是X86_64。删除 pod 和项目设置的 arm64 架构解决了这个问题,我现在可以完全在 M1 上构建项目。
以下是 ActivityMonitor 的屏幕截图。AchieveMe 是在模拟器中运行的应用程序。
要解决 Cocoapods 的问题,您可以简单地执行以下操作:
Could not find module 'MyModule' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator, at /my/path/
Run Code Online (Sandbox Code Playgroud)
我正在使用 XcodeGen,可以简单地将其添加到调试配置下,如下所示:
target.build_configurations.each do |config|
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end
Run Code Online (Sandbox Code Playgroud)
祝你好运,我希望它有帮助。我现在可以安心睡觉了。
您可以尝试打开 Xcode,并勾选“使用 Rosetta 打开”。
| 归档时间: |
|
| 查看次数: |
10503 次 |
| 最近记录: |