How can I tell the rust compiler where to look for shared object files?

Currently my code fails to compile after a full format due to libssl.so.1.1 which actually exists under /usr/lib/ so how does the rust compiler knows where to look for the so files and how can I alter those paths.
Thanks

Assuming you’re already using the openssl-sys crate, you probably need to install a development package like openssl-dev or libssl-dev on your system.

Also make sure you have pkg-config installed.

You also have:

Thats the problem i have libssl.so.1.1 under /usr/lib i dont know how to make it visible to rust

The compiler uses search paths, and they’re typically set by cargo build scripts:

https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script

If you’re using openssl-sys crate, it should have set that path for you already. You can override that path with env var OPENSSL_LIB_DIR.

If you’re not using openssl-sys crate, you should, because cross-platform support for openssl is painful.

The problem is that openssl is not a direct dependency of my project. It’s the dependency of psl which is a dependency of chttp. I have tried already setting openssl lib dir to no success i opened a bug record on chttp library i just dont understand no other application requiring libssl seems having issue except my rust build

Do you also have libssl.so (without the .1.1 suffix) in that directory? If you’re using Linux, that file is provided by the -dev or -devel package (mentioned by jethrogb above), which you’ll need to install separately from the library package, in order to compile programs that use OpenSSL.

Once you’ve install libssl-dev (or the equivalent for your OS) then you shouldn’t need to configure anything, since /usr/lib is in the default search path.

The openssl crate docs have instructions for installing the necessary packages on common platforms.

image yes i do seem to have libssl.so

The dev(el) packages provide headers, not shared objects. The shared objects are provided by the packages without the suffix.

Still, to compile often the Dev packages are needed, just because they contain the headers that are read during compile time.

But in general without knowing which crate and what the exact error is, it’s hard to tell what the problem is.