Failed to cross compile rust-openssl(openssl-src-rs) for windows msvc targets via cross-rs · Issue #797 · rust-lang/cc-rs (original) (raw)
cross-rs
: At present, cross-rs uses the Docker Ubuntu environment when compiling, and will download the wine and msvc tool chain in Ubuntu container to compile by mapping the source code into the container.
openssl
: When the vendored feature is enabled, rust-openssl will call the openssl-src-rs to build the openssl c library. openssl-src-rs
uses rust-lang/cc-rs
to find the msvc tool when compiling the openssl library.
cc::windows_registry::find(target, "nmake.exe");
thread 'main' panicked at 'failed to find nmake', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.25.1+1.1.1t/src/lib.rs:454
Although the correct VC environment has been set, the find result is still None. Then I checked ` find_tool' function:
#[cfg(not(windows))] pub fn find_tool(_target: &str, _tool: &str) -> Option { None }
When compiling cross platforms, should we use below the code to check?
// use these #[cfg(target_os=windows)] #[cfg(not(target_os=windows))]
// not use these #[cfg(windows)] #[cfg(not(windows))]
Or should we manually pass --cfg windows
to compile?