I have Rust code which is supposed to link with a dynamic library which is located in /path/to/library/build. I’m making Rust bindings/wrapper for another library written in C.
In build.rs:
println!("cargo:rustc-link-arg=-lawesome");
libawesome.so is located in /path/to/library/build.
Using this
RUSTFLAGS="-L /path/to/library/build -C link-args=-Wl,-rpath=/path/to/library/build" cargo test
I can link and execute the tests which use symbols from the dynamic the library while
RUSTFLAGS="-C link-args=-Wl,-rpath=/path/to/library/build" cargo test
Why do I need to use -L here?
How would I do this without using RUSTFLAGS?
I was expecting not to have to use -L.