alexcrichton / openssl-src-rs

Source code and logic to build OpenSSL from source
Apache License 2.0
68 stars 113 forks source link

windows vendored openssl doesn't statically link #82

Open molleafauss opened 3 years ago

molleafauss commented 3 years ago

Moving here discussion from sfackler/rust-openssl#1398

Seems that on MSVC windows the library are always built as dlls, unless the crt-static feature is enabled. This piece of code is omitting the no-shared configuration argument to the Configure script, resulting in dll being built and binaries linked against openssl-sys still requiring dll to be installed or available in PATH.

Forcing that no-static argument, allows vendored openssl to link correctly.

I don't think that the above linked configuration is correct: from what I read, crt-static is something related to the base windows libraries and should not affect the linking of a library such as openssl; besides, openssl-sys already takes care of telling cargo to link correctly the windows runtime by properly adding:

cargo:rustc-link-lib=static=libssl
cargo:rustc-link-lib=static=libcrypto
cargo:rustc-link-lib=dylib=gdi32
cargo:rustc-link-lib=dylib=user32
cargo:rustc-link-lib=dylib=crypt32
cargo:rustc-link-lib=dylib=ws2_32
cargo:rustc-link-lib=dylib=advapi32
alexcrichton commented 3 years ago

Seems reasonable to me to always statically link OpenSSL, I'm not entirely sure why configuration was left in to build openssl dylibs, that's not really ever desired when using this crate I think.

molleafauss commented 3 years ago

I can open a PR for this if you want.

alexcrichton commented 3 years ago

That'd be great!