Kitura/Kitura-Sample

... usr/bin/swift-build (No such file or directory)

Closed this issue · 11 comments

I follow all the steps for Kitura installation, but when I do

make run

It throws an error with following description

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

Hi, did you follow Step 3 completely?

After installation, make sure you update your PATH environment variable as described in the installation instructions (e.g. export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:$PATH)

I followed Installation (OS X) steps. And I have the latest Xcode (Version 7.3.1 (7D1014)) installed on my Mac.

Latest Xcode ships Swift 2.2. Kitura is developed against the Swift 3.0 snapshot specified here. You'll need to install that snapshot and set up your PATH.

I got another issue after snapshot installation

--- Invoking swift build
swift build
error: system(["/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-05-09-a.xctoolchain/usr/bin/swiftc", "--driver-mode=swift", "-I", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-05-09-a.xctoolchain/usr/lib/swift/pm", "-L", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-05-09-a.xctoolchain/usr/lib/swift/pm", "-lPackageDescription", "-target", "x86_64-apple-macosx10.10", "/Users/310237080/Projects/TestProjects/Kitura-Sample/Package.swift", "-fileno", "4"], posix_spawn error: No such file or directory (2), ["/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-05-09-a.xctoolchain/usr/bin/swiftc", "--driver-mode=swift", "-I", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-05-09-a.xctoolchain/usr/lib/swift/pm", "-L", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-05-09-a.xctoolchain/usr/lib/swift/pm", "-lPackageDescription", "-target", "x86_64-apple-macosx10.10", "/Users/310237080/Projects/TestProjects/Kitura-Sample/Package.swift", "-fileno", "4"])
make: *** [build] Error 1

Why do you have DEVELOPMENT-SNAPSHOT-2016-05-09-a installed?

I tried both.
Now I have following issue:

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

But in Xcode Swift Development Snapshot 2016-05-03 (a) is selected and my $PATH is
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

You have to add the toolchain to your path from the commandline.

After installation, make sure you update your PATH environment variable as described in the installation instructions (e.g. export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:$PATH)

I had the same issue, and it took a while to get it, because everyone just saying you should download the snapshot, and it looked like I did, but it did't work.

Here is the thing for people running OS X and having the issue.

You need to go to swift.org -> download -> snapshots -> older snapshots -> may 03, 2016

So far so good, but thing that tripped me up was that May 03, 2016 (Debug symbols), are actually two different links, i.e. May 03, 2016 is one, pointing to the snapshot and (Debug symbols) is another, pointing to the symbols, and you have to have both for it to work.

Who does a thing like that !?

Anyway, after you install both you do the export path thing, and everything works nicely.

Hope I could help.

Yes. It helped. Thank you. I had to reinstall both Debug & Snapshot, and I had to download fresh version of Kitura-Sample. It works. Thank you for your help.

So how did you fix this?

A simpler alternative is to install Xcode 8.0 beta and change the command line tools to point to 8.0. It can be done by going to Xcode > preferences > Locations > Command line tools.
Change it to Xcode 8.0.