Xcode 12,针对iOS模拟器而构建,但链接到针对iOS所构建的目标文件中,用于体系结构arm64 [英] Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
问题描述
试图在Xcode 12(测试版5)中构建大型项目(并在Xcode 11上工作),以便为iOS 14做好准备.代码库以前是Obj-C,但现在同时包含Obj-C和Swift,并使用同样是Obj-C和/或Swift的广告连播.
我已经在Xcode 12支持下发布了新的cocoapods beta(目前为1.10.0.beta 2).
荚安装成功.进行构建时,在pod框架上出现以下错误:
为iOS模拟器构建,但在为iOS架构ARM64构建的目标文件中进行链接"
当我在框架上运行lipo -info时,它具有:armv7s armv7 i386 x86_64 arm64.
以前,该项目的有效架构设置为:armv7,armv7s和arm64.
根据Apple的文档,在Xcode 12中,该设置消失了.体系结构设置为$(ARCHS_STANDARD).在排除的体系结构中我什么都没有设置.
任何人都知道这里可能会发生什么?我还无法通过一个更简单的项目来重现这一点.
基本上,您必须从项目和Pod项目中都排除arm64
用于模拟器体系结构,
-
要执行此操作,请导航至项目的 Build Settings (构建设置),然后在
Excluded Architecture
中添加值为arm64
的Any iOS Simulator SDK
.
OR
- 如果您使用自定义的
XCConfig
文件,则只需添加此行即可排除模拟器体系结构.
EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64
然后
您必须对 Pod项目执行相同的操作,直到所有可可豆荚供应商都在其 Podspec 中添加了以下内容.
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
您可以在Pod项目的 Build Settings 中手动添加Excluded Architechure
,但是当您使用pod install
时,它将被覆盖.
为此,您可以在Podfile
中添加此代码段.每次您运行pod install
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
Trying to get a large (and working on Xcode 11!) project building in Xcode 12 (beta 5) to prep for iOS 14. Codebase was previously Obj-C, but now contains both Obj-C and Swift, and uses pods that are Obj-C and/or Swift as well.
I have pulled the new beta of cocoapods with Xcode 12 support (currently 1.10.0.beta 2).
Pod install is successful. When I do a build, I get the following error on a pod framework:
"building for iOS Simulator, but linking in object file built for iOS, for architecture arm64"
When I go run lipo -info on the framework, it has: armv7s armv7 i386 x86_64 arm64.
Previously, the project had Valid Architectures set to: armv7, armv7s and arm64.
In Xcode 12, that setting goes away, as per Apple's documentation. Architectures is set to $(ARCHS_STANDARD). I have nothing set in excluded architectures.
Anyone have an idea of what may be going on here? I have not been able to reproduce this with a simpler project yet.
Basically you have to exclude arm64
for simulator architecture both from your project and the Pod project,
To do that, navigate to Build Settings of your project and add
Any iOS Simulator SDK
with valuearm64
insideExcluded Architecture
.
OR
- If you are using custom
XCConfig
files, you can simply add this line for excluding simulator architecture.
EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64
Then
You have to do the same for the Pod project until all the cocoa pod vendors are done adding following in their Podspec.
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
You can manually add the Excluded Architechure
in your Pod project's Build Settings, but it will be overwritten when you use pod install
.
In place of this, you can add this snippet in your Podfile
. It will write the neccessary Build Settings every time you run pod install
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
这篇关于Xcode 12,针对iOS模拟器而构建,但链接到针对iOS所构建的目标文件中,用于体系结构arm64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!