Crate with dependencies as shared library without dependencies


How would I go about creating a shared library version of a crate that was statically linked against its dependencies?

For instance, I cloned regex, set crate-type to dylib in [lib], and got an .so (I also used RUSTFLAGS to pass ‘-C prefer-dynamic’ so it would link dynamically against std). But that .so cannot be directly linked in without complaints about missing dependencies. Same story without prefer-dynamic, actually.

So would the only solution be to create shared libraries for all the dependencies?