简体   繁体   中英

Error building openssl-sys crate on Windows

I am trying to compile a Rust program on Windows, but I get this error message:

Compiling openssl-sys v0.6.4
failed to run custom build command for `openssl-sys v0.6.4`

[...]

failed to execute command: The system couldn't find the specified file. (os error 2)
Is `gcc` not installed? (see https://github.com/alexcrichton/gcc-rs#windows-notes for help)

--- stderr
thread '<main>' panicked at 'explicit panic', C:\Users\User\.cargo\registry\src\github.com-0a35038f75765ae4\gcc-0.3.12\src\lib.rs:510

Cargo compiled every other package without problem, but it can't compile the openssl package.

I searched for help with this specific error and found a github issue for hyperium . The first answer references the openssl building guide for Windows .

I don't understand exactly how I have to build openssl in Windows. I installed MinGW and added the bin path to the global PATH variable, so gcc is reachable, but this did not solve the error.

I use Rust 1.2 and Cargo 0.4.0. My project is an example for a Telegram API wrapper.

1) Download ssl

Installs Win32 OpenSSL v1.0.2d

Install it here: C:\\OpenSSL-Win32,C:\\OpenSSL-Win32\\include,C:\\OpenSSL-Win32\\lib

2) Install MinGW,and add system env path ,,C:\\MinGW\\bin,important,MinGW's installed path contain char 'MinGW '

3) cmd run env OPENSSLLIBDIR=C:/OpenSSL-Win32/lib OPENSSLINCLUDEDIR=C:/OpenSSL-Win32/include cargo build

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM