3

I'm trying to run Kitura project on XCode. I tried to follow instructions on this page ([https://github.com/IBM-Swift/Kitura/wiki/Building-your-Kitura-application-on-XCode]), however I failed with step 3 – run swift build -X. I get this error:

error: unable to invoke subcommand: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build (No such file or directory) 

Looks like I have latest toolchain installed (see the screenshot below). I also have both XCode 7.3.1 and XCode 8 beta. What would you suggest to solve that problem?

Alexander Doloz
  • 4,078
  • 1
  • 20
  • 36

3 Answers3

11

As Daniel mentioned above, Kitura right now requires use of the June 6 drop of the Swift Development toolchain. This toolchain can only be used with Xcode v7.3.1. The toolchain format changed between Xcode 7.x and newer Xcode 8 beta. When using the Xcode 8 beta with the new June 20 toolchain, there's another step that you need to do before you can run swift build from the command line.

From the command line, enter the following command:

$ sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer/

This command is necessary to inform Xcode where to find the required binaries and frameworks.

To switch it back, just use the same command but point it at non-beta version of Xcode:

$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/

Using these commands will eliminate the error <unknown>:0: error: Swift does not support the SDK 'MacOSX10.11.sdk' error: exit(1): that you ran into.

The Xcode 8 beta will be required to be used for all future Swift.org toolchains unless otherwise specified.

Bill Abt
  • 135
  • 6
5

As of this writing, Kitura only compiles with the 06-06 Swift Development toolchain so make sure you have that installed.

In addition the wiki was out of date, the generate Xcode project command got renamed to swift package generate-xcodeproj. I updated the wiki to reflect this change.

Daniel Firsht
  • 353
  • 4
  • 10
  • Thank you for answer! However, your suggested command fails too. I got this error: – Alexander Doloz Jun 22 '16 at 20:04
  • :0: error: Swift does not support the SDK 'MacOSX10.11.sdk' error: exit(1): /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a.xctoolchain/usr/bin/swiftc --driver-mode=swift -I /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a.xctoolchain/usr/lib/swift/pm -L /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a.xctoolchain/usr/lib/swift/pm -lPackageDescription -target x86_64-apple-macosx10.10 /Users/alexander/kitura_photo_test/Package.swift -fileno 4 – Alexander Doloz Jun 22 '16 at 20:04
  • 1
    I've heard that XCode 8 beta has had trouble running on El Capitan so try using XCode 7.3.1 if you haven't already. Also it looks like from that error that the 06-20 toolchain is still being used. In the menu bar go to XCode -> Toolchains and select the 06-06 snapshot. – Daniel Firsht Jun 22 '16 at 20:54
1

Try:

export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"
mikem
  • 112
  • 1
  • 8