Greetings,
I'm writing a Rust binding for a native library and I made a mistake of delving too deep into various theoretical linking issues.
The library itself is a wrapper over other native cryptographic library. It can depend on either OpenSSL, LibreSSL, or BoringSSL (the choice is made at build-time).
Currently I have factored raw FFF bindings into a sys
crate, but I struggle to find an ideal way of linking to the native library and its dependencies. My sys
crate does not depend on openssl-sys
, for example. But I guess it should? At least, the Cargo book suggests so. However, what if the native library depends on LibreSSL or BoringSSL? Or what if OpenSSL in openssl-sys
is different from the one expected by the library? How should I deal with static vs. dynamic linking of the library and its dependencies?
Are there any best practices is this area? (Aside from rewriting everything in Rust.)