How to override the linking path to a native lib


I’m using the rust lib GSL, which links to the native .so lib Originally there has already an installed version of libgsl in /usr/lib, however it’s too old and cannot work.

So I try to install my own newer version in my own path $HOME/root/usr/lib/.

But how can I tell cargo to link to the new one, instead of the old one?

I’v tried to modify the .cargo/config as

rustc-link-search = ["/home/blablabla/root/usr/lib"]

according to my search, but it does not work.

It seems that rustc can accept -L <path> parameter, but cargo command does not work.

Well, finally I found a solution:
just create a soft link to the .so file in .rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib


The GSL wrapper depends on pkg-config-rs, and doesn’t seem to be configurable: