coc-clangd: could not create connection to server

  • paltform: macos
  • coc-settings:
  "clangd.path":"~/.config/coc/extensions/coc-clangd-data/install/15.0.6/clangd_15.0.6/bin/clangd"
  • clangd was install in offical github-repo clangd-mac-15.6.0.zip

  • shell cmd execute

 ~/.config/coc/extensions/coc-clangd-data/install/15.0.6/clangd_15.0.6/bin/clangd
clangd is a language server that provides IDE-like features to editors.

It should be used via an editor plugin rather than invoked directly. For more information, see:
	https://clangd.llvm.org/
	https://microsoft.github.io/language-server-protocol/

clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment variable.

I[23:31:51.975] clangd version 15.0.6 (https://github.com/llvm/llvm-project 088f33605d8a61ff519c580a71b1dd57d16a03f8)
I[23:31:51.976] Features: mac+grpc+xpc
I[23:31:51.976] PID: 15297
I[23:31:51.976] Working directory: /Users/zhangjiang/workspace/faiss
I[23:31:51.976] argv[0]: /Users/zhangjiang/.config/coc/extensions/coc-clangd-data/install/15.0.6/clangd_15.0.6/bin/clangd
I[23:31:51.977] Starting LSP over stdin/stdout

seems okay.

I don’t know what’s wrong, need help THX!

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 25 (13 by maintainers)

Most upvoted comments

@oren0e set clangd.path to /usr/local/opt/llvm/bin/clangd in your coc-settings.json please.

@oren0e the clangd installed from GitHub is broken, you can delete ~/.config/coc/extensions/coc-clangd-data/, coc-clangd can use clangd from your $PATH.

Looks like the clangd downloaded from GitHub is broken, will look into this.

I get the same error after clangd installed from the command CocCommand clangd.install became version 16.0.2 a couple of days ago. If I switch back to 15.0.6 the problem disappears.

Would be good to know if this is expected to be fixed later or one should not install clangd with CocCommand any more?

I get the same error after clangd installed from the command CocCommand clangd.install became version 16.0.2 a couple of days ago. If I switch back to 15.0.6 the problem disappears.

Would be good to know if this is expected to be fixed later or one should not install clangd with CocCommand any more?

Same here:

Workaround (used for Ubuntu 22.04):

  1. Download release from https://github.com/clangd/clangd/releases/tag/16.0.2
  2. Unzip to coc-clangd installation folder, e.g. unzip clangd-linux-16.0.2.zip -d ~/.config/coc/extensions/coc-clangd-data/install/16.0.2
  3. Go into that directory and verify that you can execute binary via ./clangd --version; should print grafik
  4. Adapt clangd.path in your CocConfig (coc-settings.json).