Fix static build on windows-gnu targets

Static builds for *-pc-windows-gnu targets broke, because the linker
would look for the incorrect libraries. OpenSSL builds produce
libssl.dll rather than ssl.dll which makes the linker unhappy with the
normal -lssl -lcrypto [1].

A workaround could be used:

    export OPENSSL_LIBS="ssl:crypto"

but it's arguably better to have the openssl-sys crate do the right
thing.

[1] http://www.mingw.org/wiki/specify_the_libraries_for_the_linker_to_use
This commit is contained in:
Thomas Jespersen 2020-05-02 12:19:04 +02:00
parent e446d819e3
commit dd8e53cb0d
1 changed files with 1 additions and 1 deletions

View File

@ -86,7 +86,7 @@ fn main() {
Some(ref v) => v.split(":").collect(), Some(ref v) => v.split(":").collect(),
None => match version { None => match version {
Version::Openssl10x if target.contains("windows") => vec!["ssleay32", "libeay32"], Version::Openssl10x if target.contains("windows") => vec!["ssleay32", "libeay32"],
Version::Openssl11x if target.contains("windows") => vec!["libssl", "libcrypto"], Version::Openssl11x if target.contains("windows-msvc") => vec!["libssl", "libcrypto"],
_ => vec!["ssl", "crypto"], _ => vec!["ssl", "crypto"],
}, },
}; };