Build fail sourcekit-lsp

I cloned the sourcekit-lsp repo and ran these commands:

$ swift package update
$ swift build

and the build fails, the error message is shown on the image above.

I’m pretty sure you need to be running the latest Xcode beta to build the latest tools from source. That particular error is a new feature of Swift 5.1.

For anyone working on these tools: these issues happen every time the required Xcode version is bumped. Is it not possible to preflight the build to ensure a compatible compiler is being used? It would save a lot of time and effort.

1 Like

Thank you very much, I tried with Xcode 11 beta 3 and it build successfully.


I build it using Xcode 11 beta 3; after compilation I saw an executable inside Products from Xcode

I installed the Extension on VS Code and configured it like this

I also initialized a project using swift package manager, wrote some swift code and tried saving it I see this error on the output tab of VS code

What am I doing wrong here?

I figured it out, since the latest master branch supports swift 5.1, I had to switch my command line tools to Xcode 11 beta 3 (which is the latest Xcode beta). I am not sure why the file has not been updated, I am trying to contribute to the project and it's taking a lot of my time just to build the project.

That's a good idea. We can bump SourceKit-LSP's tools version in the manifest file so you get a nice error saying your toolchain is out-of-date if you use an older toolchain. @blangmuir what do you think?

FWIW, SourceKit-LSP's readme file mentions that you need a trunk snapshot.

The README does mention you need the latest snapshot toolchain, but previously this was only relevant when running sourcekit-lsp, since this is the first time there's been a problem building swiftpm with an older toolchain. I'll update the readme.

I'm happy to update this to match reality (Bump swift-tools-version to 5.1 by benlangmuir · Pull Request #119 · apple/sourcekit-lsp · GitHub), but swiftpm should update as well in that case, since that's where the build failure came from.