Building library from crates.io as a static library for non-Rust projects?


#1

If using Rust library as a dependency of a Rust project, eveything is handled nicely automatically. But what if I want to use a Rust library (but with crate-type=staticlib) from crates.io in a C project?

Currently the best way I know is not to use crates.io, but check out source from git and run cargo build. Is there a simpler way? Preferably also getting source from crates.io?


#2

It sounds like what you’re getting at is using crates.io to distribute binary artefacts as well as source. I think a lot of people have asked for this in the past, but I’m not sure if anything came of it. Someone like @carols10cents may know more though.

For work I’m using git submodules and recompiling to a dynamic library (cdylib) locally. My circumstances may be a bit different to the norm though because it’s a proprietary application targeting Windows… A platform which isn’t very conducive to cross compilation.