Search code examples
iosxcodecarthage

Carthage fails to start when running from Xcode 10 Build pre-action


I have simple ksh script which runs carthage update --platform iOS as a Build pre-action and it started to fail after updating to Xcode 10. Running the command in Terminal generates Carthage folder successfully.

To reproduce this issue, quit Xcode and delete DerivedData and Carthage folder. Then open Xcode 10 and try to build.

The error I get:

<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

  • Carthage 0.31.1 - 0.33.0
  • Cartfile points to Alamofire 4.7.3

Things I have tried

  • Using carthage bootstrap, didn't work
  • Raising Alamofire dependency target to iOS 8.4 and 10 (from local fork), didn't work
  • All answers from this SO question., didn't work
  • Use env -i as advised in open Carthage ticket, didn't work

Solutions

  • Select "Generic iOS Device" when building first time.
  • Passing SDK parameter directly to xcodebuild, found in this answer. This forces you to write your own carthage update, composed of checkout and build. Only this option worked as Xcode Build pre-action step. The solution was tested.

Some links

Non answered thread on Apples forums.

Closed Alamofire ticket


Solution

  • The solution that worked for me was to unset one of the env variables coming from XCode 10 just before executing carthage update:

    unset LLVM_TARGET_TRIPLE_SUFFIX

    carthage update