Xcode 12,为 iOS 模拟器构建,但链接到为 iOS 构建的目标文件,用于架构“arm64" [英] Xcode 12, building for iOS Simulator, but linking in an object file built for iOS, for architecture 'arm64'

查看:60
本文介绍了Xcode 12,为 iOS 模拟器构建,但链接到为 iOS 构建的目标文件,用于架构“arm64"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Xcode 12 (beta 5) 中构建一个大型(并在 Xcode 11 上工作!)项目来为 iOS 14 做准备.代码库以前是在 Objective-C 中的,但现在它同时包含了 Objective-C和 Swift,并使用 Objective-C 和/或 Swift 的 Pod.

我已经拉取了

  • 如果您使用自定义 XCConfig 文件,您只需添加此行以排除模拟器架构.

    EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64

    然后

    您必须对 Pod 项目 执行相同的操作,直到所有 Cocoa Pod 供应商都完成在他们的 Podspec 中添加以下内容.

    s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' =>'arm64' }s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' =>'arm64' }

    您可以在 Pod 项目的构建设置中手动添加排除的架构,但是当您使用它时它会被覆盖使用 pod install.

    代替此,您可以在 Podfile 中添加此代码段.每次运行 pod install 时,它都会编写必要的构建设置.

    post_install do |installer|installer.pods_project.build_configurations.each 做 |config|config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64";结尾结尾

I am trying to get a large (and working on Xcode 11!) project building in Xcode 12 (beta 5) to prepare for iOS 14. The codebase was previously in Objective-C, but now it contains both Objective-C and Swift, and uses pods that are Objective-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.

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 the 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 value arm64 inside Excluded 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 Architecture 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 necessary 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆