I have a project that has
crate-type = ["cdylib", "dylib", "rlib"] under the
[lib] section in its
Cargo.toml manifest i.e. something like this:
[lib] name = "foo" crate-type = ["cdylib", "dylib", "rlib"]
Since Rust 1.31 or 1.32, this has resulted in a warning, essentially saying that these options result in artifacts being built with the same name, and thus the combination is invalid.
As far as I can see, it is invalid to define multiple
[lib] sections in the
Cargo.toml file, so that idea is off the table.
I agree that artifact production clashes are undesirable.
What I’m less clear on is why the warning-and-error-to-be is produced in the first place, rather than Cargo taking care to produce 2 dynamic library files that explicitly don’t clash with one another?
And if I want both a
cdylib and a
dylib in the same crate, what can I do to resolve this issue right now, aside from using ugly hacks like creating wrapper crates?