Issue linking versioned .so library via


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

fn main() {

    let libs = [
    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/ undefined reference to MD5@OPENSSL_0.9.8

So far I've tried:

  1. In changing crypto to which should generate flag, but this gives me error:
error: library name must not be empty
  1. In changing crypto to, but this gives me error:
error: renaming of the library `crypto` was specified, however this crate contains no `#[link(...)]` attributes referencing this library

What does ldd ./libs/x64lib-linux/ show?

The output of ldd ./libs/x64lib-linux/ (0x00007ffd5e74d000) => /usr/lib/ (0x00007f40847e1000) => /usr/lib/ (0x00007f40847d9000) => /usr/lib/ (0x00007f40840b1000) => not found => not found => not found => /usr/lib/ (0x00007f4083e79000) => /usr/lib/ (0x00007f4083d91000) => /usr/lib/ (0x00007f40847b9000) => /usr/lib/ (0x00007f4083ba9000)
/usr/lib64/ (0x00007f4084811000)

Libraries and were left out in initial post, because it's the same situation, so kept it simple.

If I do LD_LIBRARY_PATH=./libs/x64lib-linux/ ldd ./libs/x64lib-linux/

./libs/x64lib-linux/ ./libs/x64lib-linux/ no version information available (required by ./libs/x64lib-linux/ (0x00007fff0a16d000) => /usr/lib/ (0x00007f6d9f689000) => /usr/lib/ (0x00007f6d9f681000) => ./libs/x64lib-linux/ (0x00007f6d9ec00000) => ./libs/x64lib-linux/ (0x00007f6d9e800000) => ./libs/x64lib-linux/ (0x00007f6d9e400000) => ./libs/x64lib-linux/ (0x00007f6d9e000000) => /usr/lib/ (0x00007f6d9ddc1000) => /usr/lib/ (0x00007f6d9f599000) => /usr/lib/ (0x00007f6d9efd9000) => /usr/lib/ (0x00007f6d9e219000) => /usr/lib/ (0x00007f6d9efb9000)
/usr/lib64/ (0x00007f6d9f6b9000) => /usr/lib/ (0x00007f6d9ef81000)

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.