#Static linking .a files into a binary

6 messages · Page 1 of 1 (latest)

nova path
#

Hello! I have a program that requires libssl.so.1.1 and libcrypto.so.1.1 and can't seem to get it to correctly link against the main binary. My current build.rs file looks like:

fn main() {
    #[cfg(feature="static")]
    {
    println!("cargo:rustc-link-search=native=/project/
    println!("cargo:rustc-link-lib=static=libcrypto.a");
    println!("cargo:rustc-link-lib=static=libssl.a");
    }
}

I've tried loading from the default /usr/lib/ paths, and changing the link search path, changed from static to dylib, changing the names of the libraries (libssl instead of libssl.so.1.1) etc etc.

Any help on why this is happening and how to get ldd to work correctly would be awesome. Thanks in advance!

bronze sandal
#

You can't statically link a .so file.

#

Static libraries cannot be dynamically linked, and dynamic libraries cannot be statically linked

#

You either have to dynamically link to ssl and crypto, or you need to procure the static versions of those libraries, possibly by compiling it yourself in a build script

nova path
#

I do also have the .a versions of these that I'm attempting to specify but it's just silently not working. No errors, etc etc.

nova path
#

Static linking .a files into a binary