Description
rustc
supports setting soname
via -C link-arg
. However, it can't be used from Cargo, since RUSTFLAGS
affects all invocations of the compiler, and it could potentially set soname
on dependencies.
Some previous discussions about soname
support were dismissed based on the fact that Rust's native ABI is not stable. That is not relevant for cdylibs, because the C ABI exposed by cdylibs is stable.
I'm interested in using this feature in cargo-deb
. soname
is required to build first-class Linux libraries (e.g. for Debian) with Rust.
I think it'd be wonderful if Cargo automatically set soname
of cdylib
to semver-major when version is >= 1.0.0 (i.e. don't set any for 0.x.x), since soname and semver-major promise basically the same thing. However, a separate Cargo.toml field, command line flag, or env var would work as well.