google / shaderc-rs

Rust bindings for the shaderc library.
https://docs.rs/shaderc
Apache License 2.0
261 stars 64 forks source link

Can't find `/usr/lib/libshaderc_shared.so` #107

Open Rua opened 3 years ago

Rua commented 3 years ago

I downloaded the pre-built shaderc library package for Linux, and unpacked it in /usr/lib. This is one of the locations where shaderc-rs will search for libraries according to the readme, and /usr/lib/libshaderc_shared.so is right there along with all the other shaderc libraries. Yet for some reason it fails to find the library, and proceeds to build from source (which fails because I uninstalled cmake). How come it's not finding the library? Is the documentation incorrect?

antiagainst commented 3 years ago

Hi, note that /usr/lib/ is just one example given for Linux system library paths: "On Linux, system library paths like ..". There is an implicit ordering in the library path:

https://github.com/google/shaderc-rs/blob/21bb994197b536acabd1ddfd3ca82f27d1150645/shaderc-sys/build/build.rs#L180-L191

And /usr/lib/ is the last one of it. I think the problem is that only directory existence was checked there; not the library. So as long as you have other directories recognized, they will be picked by the script.

This is all very tricky and ad-hoc. I think the above part should be rewritten to just use some more standardized way to probe system shared libraries.

Hopefully this clarifies.