How to include .rlib files in cargo?


#1

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


#2

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:

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

#3

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


#4

Yes I could use source code like mmmib described. Thanks