Using sourcekit-lsp on Ubuntu 18.10

Is there a way to use sourcekit-lsp on Ubuntu 18.10? sourcekit-lsp install instructions want me to point it to a toolchain, but swift.org provides toolchains only for macos, old ubuntu and even older ubuntu. I can build swift from source, but what do I set SOURCEKIT_TOOLCHAIN_PATH to?

@blangmuir

1 Like

I would expect the 18.04 toolchain to work on 18.10 as well, so please give that a try and let us know if you run into issues. + @mishal_shah in case he knows of any issues on 18.10.

1 Like

@mishal_shah
Unfortunately it cannot find libtinfo.so.5

cukier@papryka:~$ sudo apt-get install clang
Reading package lists... Done
Building dependency tree       
Reading state information... Done
clang is already the newest version (1:7.0-43ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 146 not upgraded.
cukier@papryka:~$ which swift
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/swift
cukier@papryka:~$ swift
swift: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

It looks like there is a libtinfo5 package for 18.10 that should contain that library; does installing that fix it? On 18.04 that libtinfo5 would be pulled in by our dependency on libncurses5-dev.

1 Like

Oh god. Such an easy fix. I swear I tried to find out what package provides it, and couldn't find it. Thank you very much! <3
After installing libtinfo5 and libncurses5 (not libncurses5-dev) it starts up from the toolchain!
The only problem is that I get [SR-8690] swift REPL error: adding range [0x1464a-0x146ba) which has a base that is less than the function's low PC · Issue #4488 · apple/llvm-project · GitHub , but apparently I can just ignore it.

Next step - trying lsp!

2 Likes

Unfortunately I got stuck again - this time while building sourcekit-lsp. Unfortunately there's even no error message, unless you count a single dot as one :(

cukier@papryka:~/Developer/sourcekit-lsp$ swift build -Xcxx -I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift
Fetching https://github.com/apple/indexstore-db.git
Fetching https://github.com/apple/swift-llbuild.git
Fetching https://github.com/apple/swift-package-manager.git
Completed resolution in 59.03s
Cloning https://github.com/apple/swift-package-manager.git
Resolving https://github.com/apple/swift-package-manager.git at master
Cloning https://github.com/apple/swift-llbuild.git
Resolving https://github.com/apple/swift-llbuild.git at master
Cloning https://github.com/apple/indexstore-db.git
Resolving https://github.com/apple/indexstore-db.git at master
/home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/


.

cukier@papryka:~/Developer/sourcekit-lsp$ echo $?
1
cukier@papryka:~/Developer/sourcekit-lsp$ swift build -Xcxx -I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift
/home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/


.
[8/103] Compiling IndexStoreDB_Support Concurrency-Mac.cpp
cukier@papryka:~/Developer/sourcekit-lsp$ echo $?
1
cukier@papryka:~/Developer/sourcekit-lsp$ ls ./.build/debug/
ls: cannot access './.build/debug/': No such file or directory   
cukier@papryka:~/Developer/sourcekit-lsp$ ls ./.build/
build.db   debug.yaml               manifest.db   x86_64-unknown-linux
checkouts  dependencies-state.json  repositories
cukier@papryka:~/Developer/sourcekit-lsp$ ls ./.build/x86_64-unknown-linux/debug/
clibc.build                       llbuildCore.build
gtest.build                       llbuildNinja.build
index                             llvmDemangle.build
IndexStoreDB_CIndexStoreDB.build  llvmSupport.build
IndexStoreDB_Index.build          ModuleCache
IndexStoreDB_Support.build        SourceKitLSPPackageTests.product
libllbuild.build                  sourcekit-lsp.product
llbuildBasic.build                SPMLibc.build
llbuildBuildSystem.build          SwiftPM.product
llbuildCommands.build

@Aciid is this a known issue with the output of swift-build on Linux? Any suggestions?

No, this is the first I've seen something like this. Maybe try with -v.

The dot wasn't the whole error message! Every time I run the command, the error gets cut out in a different place!

full terminal output
cukier@papryka:~/Developer/sourcekit-lsp$ swift build -Xcxx -I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift -v
lsb_release -r
which clang
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Logging.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Concurrency-Mac.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_LLVMSupport -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/raw_ostream.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/Support/raw_ostream.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/raw_ostream.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_LLVMSupport -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/circular_raw_ostream.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/Support/circular_raw_ostream.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/circular_raw_ostream.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/swiftc -module-name llbuildSwift -incremental -emit-dependencies -emit-module -emit-module-path /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/llbuildSwift.swiftmodule -output-file-map /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/llbuildSwift.build/output-file-map.json -parse-as-library -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/swift-llbuild/products/llbuildSwift/BuildSystemBindings.swift /home/cukier/Developer/sourcekit-lsp/.build/checkouts/swift-llbuild/products/llbuildSwift/CoreBindings.swift -I /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug -target x86_64-unknown-linux -swift-version 5 -enable-batch-mode -index-store-path /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/index/store -sdk / -Onone -g -enable-testing -j4 -DSWIFT_PACKAGE -DDEBUG -Xcc -fmodule-map-file=/home/cukier/Developer/sourcekit-lsp/.build/checkouts/swift-llbuild/products/libllbuild/include/module.modulemap -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/swift-llbuild/products/libllbuild/include -Xcc -fmodule-map-file=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/llbuildBuildSystem.build/module.modulemap -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/swift-llbuild/lib/BuildSystem/include -Xcc -fmodule-map-file=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/llbuildCore.build/module.modulemap -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/swift-llbuild/lib/Core/include -Xcc -fmodule-map-file=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/llbuildBasic.build/module.modulemap -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/swift-llbuild/lib/Basic/include -Xcc -fmodule-map-file=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/llvmSupport.build/module.modulemap -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/swift-llbuild/lib/llvm/Support/include -Xcc -fmodule-map-file=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/llvmDemangle.build/module.modulemap -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/swift-llbuild/lib/llvm/Demangle/include -module-cache-path /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache -Xfrontend -color-diagnostics



 error generated.
cukier@papryka:~/Developer/sourcekit-lsp$ 
cukier@papryka:~/Developer/sourcekit-lsp$ 
cukier@papryka:~/Developer/sourcekit-lsp$ swift build -Xcxx -I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift -v
lsb_release -r
which clang
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Logging.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Concurrency-Mac.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_LLVMSupport -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/raw_ostream.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/Support/raw_ostream.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/raw_ostream.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_LLVMSupport -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/YAMLTraits.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/Support/YAMLTraits.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/YAMLTraits.cpp.o



.
cukier@papryka:~/Developer/sourcekit-lsp$ swift build -Xcxx -I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift -v
lsb_release -r
which clang
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Logging.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_LLVMSupport -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/raw_ostream.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/Support/raw_ostream.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/raw_ostream.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Concurrency-Mac.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_LLVMSupport -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/YAMLTraits.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/Support/YAMLTraits.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/YAMLTraits.cpp.o



.
/home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Logging.cpp:19:10: fatal error: 'dispatch/dispatch.h' file not found
#include <dispatch/dispatch.h>
         ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
cukier@papryka:~/Developer/sourcekit-lsp$ swift build -Xcxx -I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift -v
lsb_release -r
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/swiftc --driver-mode=swift -L /home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift/pm/4_2 -lPackageDescription -swift-version 4.2 -I /home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift/pm/4_2 -sdk / /home/cukier/Developer/sourcekit-lsp/Package.swift -fileno 7
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/swiftc --driver-mode=swift -L /home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift/pm/4_2 -lPackageDescription -swift-version 4.2 -I /home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift/pm/4_2 -sdk / /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/Package.swift -fileno 7
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/swiftc --driver-mode=swift -L /home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift/pm/4_2 -lPackageDescription -swift-version 4.2 -I /home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift/pm/4_2 -sdk / /home/cukier/Developer/sourcekit-lsp/.build/checkouts/swift-package-manager/Package.swift -fileno 7
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/swiftc --driver-mode=swift -L /home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift/pm/4_2 -lPackageDescription -swift-version 5 -I /home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift/pm/4_2 -sdk / /home/cukier/Developer/sourcekit-lsp/.build/checkouts/swift-llbuild/Package.swift -fileno 7
which clang
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Logging.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Concurrency-Mac.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_LLVMSupport -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/raw_ostream.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/Support/raw_ostream.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/raw_ostream.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_LLVMSupport -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/YAMLTraits.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/Support/YAMLTraits.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/YAMLTraits.cpp.o



.
cukier@papryka:~/Developer/sourcekit-lsp$ swift build -Xcxx -I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift -v
lsb_release -r
which clang
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=Csourcekitd -I /home/cukier/Developer/sourcekit-lsp/Sources/Csourcekitd/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/Csourcekitd.build/sourcekitd.c.d -c /home/cukier/Developer/sourcekit-lsp/Sources/Csourcekitd/sourcekitd.c -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/Csourcekitd.build/sourcekitd.c.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_CIndexStoreDB -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/CIndexStoreDB/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Index/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Database/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Core/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_CIndexStoreDB.build/CIndexStoreDB.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/CIndexStoreDB/CIndexStoreDB.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_CIndexStoreDB.build/CIndexStoreDB.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Logging.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Concurrency-Mac.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.o
/home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Concurrency-Mac.cpp:18:10: fatal error: 'dispatch/dispatch.h' file not found
#include <dispatch/dispatch.h>
         ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
cukier@papryka:~/Developer/sourcekit-lsp$ swift build -Xcxx -I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift -v
lsb_release -r
which clang
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Concurrency-Mac.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Logging.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_LLVMSupport -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/raw_ostream.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/Support/raw_ostream.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/raw_ostream.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_LLVMSupport -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/YAMLTraits.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/Support/YAMLTraits.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/YAMLTraits.cpp.o



.
cukier@papryka:~/Developer/sourcekit-lsp$ swift build -Xcxx -I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift -v
lsb_release -r
which clang
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Logging.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Logging.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_LLVMSupport -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/raw_ostream.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/Support/raw_ostream.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/raw_ostream.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_Support -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/include -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Concurrency-Mac.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_Support.build/Concurrency-Mac.cpp.o
/home/cukier/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/bin/clang -target x86_64-unknown-linux --sysroot / -fPIC -g -O0 -DSWIFT_PACKAGE=1 -DDEBUG=1 -fblocks -fmodules -fmodule-name=IndexStoreDB_LLVMSupport -I /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/include -fmodules-cache-path=/home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/ModuleCache '-I~/Developer/swift-5.0-RELEASE-ubuntu18.04/usr/lib/swift' -MD -MT dependencies -MF /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/YAMLTraits.cpp.d -std=c++11 -c /home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/LLVMSupport/Support/YAMLTraits.cpp -o /home/cukier/Developer/sourcekit-lsp/.build/x86_64-unknown-linux/debug/IndexStoreDB_LLVMSupport.build/Support/YAMLTraits.cpp.o



.
/home/cukier/Developer/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Logging.cpp:19:10: fatal error: 'dispatch/dispatch.h' file not found
#include <dispatch/dispatch.h>
         ^~~~~~~~~~~~~~~~~~~~~
.

The path I provided was wrong - it has to be absolute, without the ~ :/ After I changed it - it compiles.

Thank you everyone for help! It works now! (As long as I create a new package. Somehow the sourcekit-lsp crashes when I open an old package, that I edited with LSP in the past. (deleting the .build directory fixed that package))

If you can reproduce this crash, it would be great to file a bug at bugs.swift.org and attach the code + .build directory content.

My celebration was premature. It crashes for new packages too. If I do:

  • swift package init --type executable
  • swift run
  • ctrl+k ctrl+o and then select that directory in Visual Studio Code
    it prints this:
[Info  - 11:42:00 PM] Connection to server got closed. Server will restart.
[Info  - 11:42:00 PM] Connection to server got closed. Server will restart.
[Info  - 11:42:01 PM] Connection to server got closed. Server will restart.
[Info  - 11:42:01 PM] Connection to server got closed. Server will restart.
[Error - 11:42:01 PM] Connection to server got closed. Server will not be restarted.

If I open the directory in VSC first, and then build it everything works perfectly (until I close VSC)

I tried to attach debugger to the server (as described here), but lldb errors out too

cukier@papryka:~/Desktop/lsp/foo$ lldb -w -n sourcekit-lsp
(lldb) process attach --name "sourcekit-lsp" --waitfor
error: attach failed: lost connection
(lldb) 

Attaching a debugger to the extension (as described here) and setting a breakpoint at all exceptions shows "Error: Cannot find module 'supports-color'" being thrown, but I'm not sure how relevant that is.

Is that the full output from the console if you select "OUTPUT > SourceKit Language Server"? If you turn on tracing (Settings > sourcekit-lsp > Trace), do you get any additional information?

Yes

Yes

trace - messages
[Trace - 7:03:32 AM] Sending request 'initialize - (0)'.
[Info  - 7:03:32 AM] Connection to server got closed. Server will restart.
[Trace - 7:03:32 AM] Sending request 'initialize - (0)'.
[Info  - 7:03:32 AM] Connection to server got closed. Server will restart.
[Trace - 7:03:32 AM] Sending request 'initialize - (0)'.
[Info  - 7:03:32 AM] Connection to server got closed. Server will restart.
[Trace - 7:03:32 AM] Sending request 'initialize - (0)'.
[Trace - 7:03:32 AM] Received response 'initialize - (0)' in 92ms.
[Trace - 7:03:32 AM] Sending notification 'initialized'.
[Trace - 7:03:32 AM] Sending notification 'textDocument/didOpen'.
[Info  - 7:03:32 AM] Connection to server got closed. Server will restart.
[Trace - 7:03:32 AM] Sending request 'initialize - (0)'.
[Error - 7:03:33 AM] Connection to server got closed. Server will not be restarted.

trace - verbose

I can reproduce a crash, but I'm not sure if it's the same one you're seeing because I get different output. Could you please try to get a backtrace from sourcekit-lsp? Here's what I did:

$ code path/to/project
## Ensure no .swift files are open so that sourcekit-lsp hasn't launched yet

$ sudo lldb # you may not need sudo, but I did in order to attach

## Open a .swift file and then quickly:
(lldb) process attach -n sourcekit-lsp
Process 3718 stopped

(lldb) continue
## Crash

(lldb) bt

Also, we should move this to a bug report on bugs.swift.org. If you're able to attach the project you're using, please do - that might also be important.

1 Like
1 Like

Any updates on this? Been having the exact same problem with swift 5.1 and Ubuntu 18.04

LSP doesn't crash for me anymore. I'm not sure when it fixed itself.
I checked swift-5.1-DEVELOPMENT-SNAPSHOT-2019-05-29-a-ubuntu18.04 toolchain on Ubuntu 19.04

Hmm... That’s exactly the same tool chain I am using. What sourcekit Version are you using? The latest on master or the release tagged for 5.1 (5/29)? I am using the tagged release

I was on something close to the current master. I checked out commit 76ee75da08bc2ab9a50d6049dd08fb3f9dc5d51f (I think that's the one you're using) and it's broken for me too.