How to install sourcekit-lsp for vscode on ubuntu18.04?

I tried to follow the instructions from official github to install.
but still can't make sourcekit-lsp work in my vscode on ubuntu.

Can someone teach me how to install it on ubuntu18.04?
thanks

At which step does it break? Do you get any error messages?

using this command:
swift build -Xcxx -I~/swift5/usr/lib/swift

the error message i got:
[96/189] Compiling IndexStoreDB_LLVMSupport Support/WithColor.cpp
^

cannot initialize return object of type 'dispatch_queue_attr_t' (aka 'dispatch_queue_attr_s *') with an r

cannot initialize return object of type 'dispatch_queue_attr_t' (aka 'dispatch_queue_attr_s *') with an r

cannot initialize return object of type 'dispatch_queue_attr_t' (aka 'dispatch_queue_attr_s *') with an r

/home/carlhung/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Concurrency-Mac.cpp:29:12: error: use of undeclared identifier 'DISPATCH_QUEUE_PRIORITY_BACKGROUND'
return DISPATCH_QUEUE_PRIORITY_BACKGROUND;
^

candidate function not viable: no known conversion from 'dispatch_queue_attr_t' (aka 'dispatch_queue_attr

/home/carlhung/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Concurrency-Mac.cpp:119:3: error: use of undeclared identifier 'dispatch_barrier_async_f'
dispatch_barrier_async_f(queue, Context, CFn);
^

11 errors generated.

Could you try using absolute path for Xcxx instead of the one starting with ~? I got burned by it when I tried to install sourcekit-lsp

i can compiled now.
but i have another problem.
got this message:
Fetching GitHub - apple/swift-llbuild: A low-level build system, used by Xcode and the Swift Package Manager
Fetching GitHub - apple/swift-package-manager: The Package Manager for the Swift Programming Language
Fetching GitHub - apple/indexstore-db: Index database library for use with sourcekit-lsp
Completed resolution in 55.64s
Cloning GitHub - apple/indexstore-db: Index database library for use with sourcekit-lsp
Resolving GitHub - apple/indexstore-db: Index database library for use with sourcekit-lsp at master
Cloning GitHub - apple/swift-llbuild: A low-level build system, used by Xcode and the Swift Package Manager
Resolving GitHub - apple/swift-llbuild: A low-level build system, used by Xcode and the Swift Package Manager at master
Cloning GitHub - apple/swift-package-manager: The Package Manager for the Swift Programming Language
Resolving GitHub - apple/swift-package-manager: The Package Manager for the Swift Programming Language at master
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
/home/carlhung/sourcekit-lsp/.build/checkouts/swift-llbuild/lib/llvm/Support/Unix/Process.inc:336: error: undefined reference to 'setupterm'
/home/carlhung/sourcekit-lsp/.build/checkouts/swift-llbuild/lib/llvm/Support/Unix/Process.inc:354: error: undefined reference to 'tigetnum'
/home/carlhung/sourcekit-lsp/.build/checkouts/swift-llbuild/lib/llvm/Support/Unix/Process.inc:358: error: undefined reference to 'set_curterm'
/home/carlhung/sourcekit-lsp/.build/checkouts/swift-llbuild/lib/llvm/Support/Unix/Process.inc:359: error: undefined reference to 'del_curterm'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
:0: error: link command failed with exit code 1 (use -v to see invocation)

Could you try installing libncurses5-dev and libncurses5 and try again? It helped when I tried to install sourcekit-lsp on 18.10 (Using sourcekit-lsp on Ubuntu 18.10)

thanks.
it looks work.

1 Like