简体   繁体   中英

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?

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.

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.

尝试:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM