[clangd] Fix remote index build on macOS
macOS builds suddenly started failing:
This patch makes use of imported libraries and fixes builds for macOS.
Landing this without a review since the patch is quite straightforward
and I've been testing it on my local macOS machine for a while.
Differential Revision: https://reviews.llvm.org/D84928