Clang tries to execute llvm-link with wrong path

When trying to build a project clang tries to execute /nix/store/…-clang-9.0.1/bin/llvm-link, but llvm-link is only available in the llvm/bin dictionary.

This seems to be a problem with the clang binary, because this also happens when calling the unwrapped clang library directly. Any ideas how I can get clang to use the correct path for llvm-link?

In case anyone has the same problem (most likely not using nix), The problem is no fixed in clang >=10 and the patch will be applied in nixpkgs (clang_7,clang_8,clang_9: fix compilation of HIP-code by DieGoldeneEnte · Pull Request #78308 · NixOS/nixpkgs · GitHub). Another simple fix is to just create a derivation and symlink the missing binaries (needed: llvm-link, lld, llc, opt, maybe also clang-offload-bundler for clang >7).