Cargo can't set rpath into library or binary
build.rs
println!("cargo:rustc-link-arg=-Wl,-rpath={}", &libdir);
I set rpath in this way but it didn't take effect. How to set rpath into library or binary?
Thank you for your reply.
There is an rpath setting in the profiles you can set, does that help?
There is an rpath setting in the profiles you can set, does that help?
When I use conda, there is an environment variable that stores the library path like $CONDA_PREFIX. If it is set in the configuration file, the environment variable cannot be automatically matched.
The link arguments should be passed to the binary. Can you provide a reproduction or any other details to indicate what you've tried and why it doesn't appear to be working? If I try a simple binary with your example, I get:
objdump -x target/debug/foo | grep runpath
RUNPATH /home/eric/Temp
where that is a path I added in build.rs.
Closing as there doesn't appear to be enough information here to move this forward. If the questions above could be answered, preferably with a full reproduction and set of steps, feel free to re-open.