Random pro-tip: if you want use clangd on project, make sure it builds with clang when generating the compile-commands.json file.

But sometimes the projects don't build with clang (I was recently looking at ipxe), and working with gcc build commands might be enough, at least on x86_64.
But on arm64, a specific flags was passed, -mabi=lp64. You can configure clangd to skip those flags on a per-project basis:
https://github.com/clangd/clangd/issues/734#issuecomment-814978138

#clangd #arm64

Couldn't build compiler instance · Issue #734 · clangd/clangd

I use bear command to generate compile_commands.json file. And use clangd as spacemacs lsp backend. In my linuxkernel_5.0 project, I encounter errors below. LSP :: Error from the Language Server: i...

GitHub
And you're probably wondering: if the project does not build with clang, why use clangd? The answer is simple: some files might build properly with clang, and you'll want to use an LSP with those. Some others might not, but you'll be less likely to touch those. If 95% of the project already builds with clang, you can do useful work with clangd without having to mess with cscope/ctags – or worse, like going on a multi-days/weeks side-quest to make the project multi-compilers aware.