Alexander Doloz
Alexander Doloz

Reputation: 4198

swift build doesn't work

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?

Upvotes: 3

Views: 4319

Answers (3)

Bill Abt
Bill Abt

Reputation: 145

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.

Upvotes: 11

mikem
mikem

Reputation: 112

Try:

export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"

Upvotes: 1

Daniel Firsht
Daniel Firsht

Reputation: 383

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.

Upvotes: 5

Related Questions