Hello. I'm concerned about Rust's slow compile times & big target
directories. I'd like to do this: build all lib
dependencies of some bin
crate as dylib
, put them in some system-wide directory, build this bin
crate and finally link to those dylib
's. It'll greatly speed up compile times as many Rust projects have big common dependencies like nalgebra
, serde
, syn
& so on.
My question is, how to accomplish this with cargo? If this can't be done with plain cargo
, which external crates should I use? If there aren't any existing solutions for my problem, then please give me a hint how to implement this myself? Maybe as a cargo plugin?
Also will my approach work for crates having lots of generics and even const generics, like nalgebra
? I mean is it supposed to work across crate bounds with dynamic linker? AFAIK linkers don't know about generics at all and function names are mangled.
I'm aware that Rust has no stable ABI. But I would be happy to get it working at least using the same version of compiler for all crates.