Description
I maintain a -sys
crate but my users keep getting
error: multiple packages link to native library `z`, but a native library can be linked only once
I thought that had been fixed in rust-lang/cargo#4978 but it doesn't seem to be working. What can I do?
In fact this is mostly a place for me to link people to, to unify the discussion. I will try to keep this up to date with any discussion below.
it doesn't seem to be working
Here is why rust-lang/cargo#4978 doesn't seem to be working for you.
rust-lang/cargo#4978 only stops that error for crate with the links
attribute in the index. That attribute only gets into the index if you publish the crate with a recent nightly/beta. So no protection for the older versions of your crate.
What can I do?
You can manually make a PR to the index to add the attribute to older versions.
Someone could scan all crates to find all the missing links
attributes and add them.
It is not yet clear what the cargo team recommends at this time.