9

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

Boris Y.
  • 4,387
  • 2
  • 32
  • 50

3 Answers3

7

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

Tomasz Zabłocki
  • 1,326
  • 7
  • 14
4

In my case, restarting macOS fixed the problem.

mishimay
  • 4,237
  • 1
  • 27
  • 23
2

I found a way that actually does the trick and its:

write one valid command write after carthage update command

So follow this checklist:

  • Ensure that your command line tools are configured to use Xcode 10.1. Run the following command from Terminal:

    sudo xcode-select -s <path to Xcode 10.1>/Contents/Developer

  • Ensure that script file has required permissions:

    chmod 777 <path-to-script-file>

  • Write one valid command write after carthage update command, For example echo succeed (This actually do the trick):

    Example

Tested environment:

  • Carthage 0.31.2
  • Xcode 10.1

Working Demo

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

- THE MOST IMPORTANT STEP

  • DON'T FORGET to write one valid command write after carthage update command

Note that this is just a hack around the issue explained in question, not all carthage issues.

Mojtaba Hosseini
  • 95,414
  • 31
  • 268
  • 278
  • 1
    That's a negative. The particular issue only occurs when running Carthage as a Run Script Build Phase defined in Xcode. I get the same behavior in 0.31.2 and 10.1 as I have observed with 0.31.1 and 10.0. Carthage works fine on the command line directly. Do you have this working in a sample project? – bensnider Nov 05 '18 at 22:43
  • I also experience the same issue with Carthage 0.31.2 and Xcode 10.1. – Dávid Pásztor Nov 06 '18 at 12:15
  • @DávidPásztor try following step by step guid that I added. – Mojtaba Hosseini Nov 07 '18 at 10:10
  • @MojtabaHosseini still no luck. I have a way more complex pre-build script than simply calling `carthage update`, so it already executes quite a few valid commands after `carthage update`. I'm calling a shell script from the pre-build action, not writing `carthage update` directly into the pre-build action. – Dávid Pásztor Nov 07 '18 at 10:23
  • Checkout the demo. It uses script file as the original question needs. @DávidPásztor – Mojtaba Hosseini Nov 07 '18 at 10:39
  • I don't have your complicated script to test, but I think you can add the echo after calling your script like: `"${SRCROOT}/UpdateCarthage.ksh" echo succeed` @DávidPásztor – Mojtaba Hosseini Nov 07 '18 at 10:58
  • Indeed, if you check out your very own example @MojtabaHosseini, delete the `Carthage` folder, and re-run Xcode, the build will fail because the actual carthage update step fails to build the Alamofire framework. – bensnider Nov 13 '18 at 15:24
  • 1
    Anyway, FWIW, I'm working around this by just alerting developers to run our "carthage update/bootstrap" script when we detect a change in the Cartfile and/or the Cartfile.resolved. And, CI is doing the same but with a shell step of its own that executes the carthage update script as necessary before running xcodebuild. – bensnider Nov 13 '18 at 15:30
  • This does not work for me either, as @bensnider has described – drkibitz Nov 18 '18 at 05:20
  • `No entry found for dependencies echo, succeed in Cartfile.` – Umit Kaya Aug 14 '19 at 10:50