I'm currently trying to use a C library in my rust project, but have never worked with linking C library to Rust and googling my issues didn't yield much.
This is my build.rs:
fn main() {
println!("cargo:rustc-link-search=native=./libs/x64lib-linux");
let libs = [
"crypto",
"idkit",
...
];
for lib in libs.iter() {
println!("cargo:rustc-link-lib={}", lib);
}
}
./libs/x64lib-linux looks like this via ls ./libs/x64lib-linux -l:
The issue is, when rust tries to link libraries, I'm getting error: /usr/bin/ld: ./libs/x64lib-linux/libidkit.so: undefined reference to MD5@OPENSSL_0.9.8
So far I've tried:
In build.rs changing crypto to :libcrypto.so.0.9.8 which should generate -l:libcrypto.so.0.9.8 flag, but this gives me error:
error: library name must not be empty
In build.rs changing crypto to crypto:libcrypto.so.0.9.8, but this gives me error:
error: renaming of the library `crypto` was specified, however this crate contains no `#[link(...)]` attributes referencing this library