How to include .rlib files in cargo?


I have an extern crate foo.rlib, which is not from and I would like to use it in my rust program. Its local on my computer. How can I tell cargo to use it?


I’m not sure whether/how that works with an rlib file, but if you have the source of the crate in a local directory, you can include it in your Cargo.toml like so:

your_other_crate = { path = "/absolute/or/relative/path/of/the/other/crate's/root/directory" }


Something like that would probably also be required to reasonably package rest libs in Linux distros.


Yes I could use source code like mmmib described. Thanks