Is this the proper way to specify statically compiled FFI libraries?


I was wondering about statically compiling FFI libraries into a rust binary. I read through and saw an answer on While that SO answer worked, it gave me a deprecation warning:

warning: an arbitrary build command has now been deprecated. It has been replaced by custom build scripts. For more information, see

So I just wanted to verify that this is the proper way to set up statically statically compiled libraries with cargo. Re-using the snappy example:

# in Cargo.toml
build = ""

# in
fn main() {
    println!("cargo:rustc-flags= -L /usr/local/lib")

# in
#[link(name = "snappy", kind = "static")]

I put together a complete buildable example on github. But I wanted to ask if this the proper way to do it before I commented or posted a new answer to the existing SO thread.

Thanks for your help!


closed #2

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.