Could Cargo install precompiled crates?

Hi all,

I come from the Python world and just started looking at Rust. In Few or many features by default, we discussed the cost of adding default dependencies to a crate.

As I understand it, one cost is the compilation time, and this made me wonder if it would be possible to put precompiled crates on crates.io and have Cargo download them?

In Python, such a precompiled module is called a "wheel" and since they were introduced some years ago, they've helped make pip install both faster and easier. It's faster since the wheel is a zip file that is simply unpacked on installation. It's also easier since your users no longer need to go through the trouble of installing the right libraries on their systems in order to compile Python C extension modules.

I found a comment on GitHub where @alexcrichton mentioned that it's difficult to distribute precompiled crates due to an unstable ABI. I suppose that also apply to what I'm asking here:

https://github.com/rust-lang/cargo/issues/2552#issuecomment-208406732

1 Like

There's a proposal for a distributed build cache which would possibly solve your actual need:

https://github.com/rust-lang/cargo/issues/1997#issuecomment-265859868

1 Like