从Xcode 10 Build预操作运行时,Carthage无法启动

问题描述 投票:7回答:2

我有简单的ksh脚本,它运行carthage update --platform iOS作为Build pre-action,它在更新到Xcode 10后开始失败。在Terminal中运行命令会成功生成Carthage文件夹。

要重现此问题,请退出Xcode并删除DerivedDataCarthage文件夹。然后打开Xcode 10并尝试构建。

我得到的错误:

<unknown>:0: error: unable to load standard library for target 'arm64-apple-ios8.0-simulator'

** ARCHIVE FAILED **


The following build commands failed:
    CompileSwift normal armv7
    CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
    CompileSwift normal arm64
    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(4 failures)
Build Failed

Setup

  • 迦太基0.31.1 - 0.33.0
  • Cartfile指向Alamofire 4.7.3

Things I have tried

  • 使用carthage bootstrap,没有用
  • 将Alamofire依赖目标提升到iOS 8.4和10(来自本地分支),没有用
  • this SO question.的所有答案都没有用
  • env -i建议使用open Carthage ticket,没有用

Solutions

  • 第一次构建时选择“Generic iOS Device”。
  • 将SDK参数直接传递给xcodebuildfound in this answer.这会强制您编写自己的carthage update,由checkout和build组成。只有此选项可用作Xcode Build预执行步骤。 The solution was tested.

Some links

Non answered thread on Apples forums.

Closed Alamofire ticket

ios xcode carthage
2个回答
5
投票

对我有用的解决方案是在执行carthage更新之前取消设置来自XCode 10的一个env变量:

取消设置LLVM_TARGET_TRIPLE_SUFFIX

迦太基更新


1
投票

我发现了一种实际上可以解决这个问题的方法:

在carthage update命令之后写一个有效的命令write

请遵循以下清单:

  • 确保将命令行工具配置为使用Xcode 10.1。从终端运行以下命令: sudo xcode-select -s <path to Xcode 10.1>/Contents/Developer
  • 确保脚本文件具有所需的权限: chmod 777 <path-to-script-file>
  • carthage update命令之后写一个有效的命令写,例如echo succeed(这实际上是诀窍): Example

经过测试的环境:

  • Carthage 0.31.2
  • Xcode 10.1

工作演示

https://github.com/MojtabaHs/Carthage-WorkingDemo

- 最重要的步骤

  • 请勿忘记在carthage update命令后写入一个有效的命令

请注意,这只是围绕问题解释的问题,而不是所有的迦太基问题。

© www.soinside.com 2019 - 2024. All rights reserved.