I've been trying to debug some issues with clangd on a test build of qt-creator-8.0.0_beta1. Having made attempts to work around the issue in an earlier version of qt-creator, it appears that clangd expects to find clang's standard headers at ../lib/clang/<version>/include (see https://github.com/gentoo/qt/pull/252#issuecomment-1164987058). From https://clangd.llvm.org/troubleshooting#cant-find-compiler-built-in-headers-stddefh-etc: > They must be found in ../lib/clang/<version>/include. If you’ve built clangd > from source or installed it from a package, these should be in the right > place. If you’ve moved the binary around, move it back! With clang-14.0.5, that would be /usr/lib/llvm/14/lib/clang/14.0.5/include. By default, that is where the build installs it, but in multilib_src_install(), there's: > mv "${ED}"/usr/lib/llvm/${SLOT}/$(get_libdir)/clang "${ED}"/usr/include/clangrt || die And in src_install() there's: > # Move runtime headers to /usr/lib/clang, where they belong > mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die After omitting those lines and remerging, clangd finds the headers and all is well. Although there exists the clangd flag '--resource-dir=', from `clangd --help-list-hidden`, if would seem to be a workaround that IDE's would have no reasonable expectation to have to support. Furthermore, I could find no other distro that seemed to move the headers to the location Gentoo does. Although it would present an unaesthetic asymmetry to leave clang's headers in the llvm prefix path, it would resolve issues with clangd.
This is clangd bug. Clang is built with CLANG_RESOURCE_DIR, so I don't see any reason why clangd would hardcode some stupid magic instead of using that. Or calling `clang -print-resource-dir` that would also work.
Sorry. It appears you're right. Clangd references CLANG_RESOURCE_DIR with > Driver::GetResourcesPath(ClangExecutable, CLANG_RESOURCE_DIR) The problem is with assumptions made in qt-creator codebase.