In build.rs
of level1-sys
crate I have:
let dst = cmake::Config::new(Path::new("somelib"))
.build()
.join("build");
println!("cargo:rustc-link-search=native={}", dst.display());
println!("cargo:rustc-link-lib=dylib=somelib");
then there is level2
create that deped on level1-sys
,
and then there is level3
binary crate.
If I run this level3
crates via cargo run
all works fine,
but if I run it by hands it reports:
error while loading shared libraries: libsomelib.so: cannot open shared object file: No such file or directory
Is there way to find path to libsomelib.so
from cargo
?
I need this info for external script that should pack binary.
Obviously I can search in target
subdirectory,
but I use debug/release/cross compilation and so on thing.
Plus even for concrete variant like target/release
after several rebuild of level1-sys
there are several libsomelib.so
libraries, like:
target/release/build/level1-sys-46422ddc8585ba79/libsomelib.so
target/release/build/level1-sys-9daa760ee41fe7b8/libsomelib.so