迦太基构建失败 [英] Carthage Build Failed

查看:117
本文介绍了迦太基构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行carthage bootstrap --platform iOS并得到由于错误而跳过安装realm-cocoa.framework二进制文件:不兼容的Swift版本-框架是使用3.1生成的,本地版本是4.0",然后在生成结束时我构建失败:任务失败,退出代码为65" 错误.

它将我指向derivedDataPath,我检查了xcodebuild日志以获取更多详细信息,该日志使我知道"PhaseScriptExecution Download \ Core \和\ Sync/Users/user/Libary/Caches/org.carthage .CarthageKit/DerivedData/9.0_9A ###/realm-cocoa/v2.10.2/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Script-X#X#X#X#X.sh (1次失败)".

但是我仍然不太确定Realm Cocoa到底发生了什么,还是知道如何解决?

解决方案

TL; DR:确保您使用的是Xcode随附的最新Swift版本,然后执行carthage bootstrap --no-use-binaries --platform iOS --cache-builds

长版:

在构建项目Incompatible Swift version - framework was built with 3.1 and the local version is 4.0时从Xcode遇到的错误是由于Carthage下载以获取Realm Framework的预构建版本(这是一个节省时间的功能,但有时存在版本不兼容)就像这个).

此下载的预构建框架是使用Swift的早期版本编译的(在这种情况下,错误指向v3.1.)此错误的解决方案是使用不同的命令执行依赖项安装过程:

carthage bootstrap --platform iOS --no-use-binaries

这将使项目依赖项构建成功.无论如何,这可能要花费很长时间,因为每次执行命令时,它将从核心重新构建Realm.framework和RealmSwift.framework.因此,可以为迦太基上的构建启用本地缓存.依赖项可以通过安装

carthage bootstrap --no-use-binaries --platform iOS --cache-builds

通过此选项,迦太基将:

  • 引导程序,因此将使用Cartfile.resolved中的版本,而不会进行更新.
  • --no-use-binaries无需下载预先构建的框架即可构建依赖关系(避免版本不兼容).
  • --platform iOS将构建仅在iOS上使用的依赖项,避免在依赖项支持的情况下为Apple TV或Mac OS构建框架.这将节省很多时间!
  • --cache-builds将使Carthage在本地缓存上存储构建的依赖项(并在需要时使用它),因此,即使再次执行该命令,它也只会复制存储的框架,从而避免了另一个耗时的构建过程

I ran carthage bootstrap --platform iOS and got "Skipped installing realm-cocoa.framework binary due to the error: Incompatible Swift version - framework was built with 3.1 and the local version is 4.0", and then at the end of the build I got a full on "Build Failed: Task failed with exit code 65" error.

It points me to the derivedDataPath, and I checked the xcodebuild log for more details where it let me know "PhaseScriptExecution Download\ Core\ and\ Sync /Users/user/Libary/Caches/org.carthage.CarthageKit/DerivedData/9.0_9A###/realm-cocoa/v2.10.2/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Script-X#X#X#X#X.sh (1 failure)".

But I'm still not totally sure what exactly is happening with Realm Cocoa, or how to fix, do you know?

解决方案

TL;DR: Ensure you're using the latest Swift version, included with Xcode, and then perform carthage bootstrap --no-use-binaries --platform iOS --cache-builds

Long version:

The error you got from Xcode while building your project, Incompatible Swift version - framework was built with 3.1 and the local version is 4.0, is due to a download performed by Carthage to get a pre-built version of Realm Framework (this is a time-saver feature but sometimes there are version incompatibilities like this one).

This downloaded pre-built framework was compiled with a previous version of Swift (in this case the error is pointing v3.1 was used.) The solution for this error will be to perform the dependencies installation process using a different command:

carthage bootstrap --platform iOS --no-use-binaries

This will work for the project dependencies build to succeed. Anyway this might take a long time since it will build from scratch the Realm.framework and RealmSwift.framework from the core every time the command is executed. So it is possible to enable a local cache for the builds on Carthage. The dependencies can be installed with

carthage bootstrap --no-use-binaries --platform iOS --cache-builds

With this options Carthage will:

  • bootstrap, so the versions in the Cartfile.resolved will be used, no updates.
  • --no-use-binaries build the dependencies with no downloads of pre-built frameworks (avoiding the version incompatibility.)
  • --platform iOS will build the dependencies for be used only on iOS, avoiding building frameworks for Apple TV or Mac OS in case the dependency supports it. This will cut a lot of time!
  • --cache-builds will enable Carthage to store your built dependencies (and use it when re-needed) on a local cache, so even if you perform the command again it will just copy your stored framework, avoiding another time consuming build process.

这篇关于迦太基构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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