A recent rustc linking change has exposed that some crates link to libraries that can't be put in the crate's manifest links
because the linked libraries aren't known until build-time, and that can cause build errors when other crates attempt to link against the same library.
In the case of llvm-sys
, libffi
is sometimes pulled in because LLVM can be configured to use libffi itself, but this is impossible to know until build time since it's an optional dependency of LLVM. I imagine there may be other C library bindings that may exhibit similar behavior, but am not aware of any right now.
It seems like handling this correctly would require allowing build scripts to emit a build-time equivalent of the links
field in the crate manifest: is that a feasible thing to support? Or is there an alternative way to handle this sort of situation that I'm missing?