windowsopensslrustiron

Can't build Iron hello world on Windows


I'm trying to build the Iron hello world example, but have a problem with OpenSSL.

My OS is Windows 1 and I have tried Rust stable (1.7) and nightly (1.9).

I've installed OpenSSL with mingw and set the environment variables OPENSSL_LIB_DIR and OPENSSL_INCLUDE_DIR. Just in case, I've added the paths to the PATH variable. None of these changes fix the problem.

Cargo's output like in this question: compilation of openssl-sys fails with `openssl/hmac.h: No such file or directory`

failed to run custom build command for `openssl-sys-extras v0.7.6`
Process didn't exit successfully: `C:\Users\sharp_000\Dropbox\Код\Rust\MTFQ\target\release\build\openssl-sys-extras-52d5315fb71d3c6d\build-script-build` (exit code: 101)
--- stderr
thread '<main>' panicked at 'explicit panic', C:\Users\sharp_000\.cargo\registry\src\githubcom-88ac128001ac3a9a\gcc-0.3.25\src\lib.rs:818

I copied the include/openssl directory, libssl32.dll, and libeay32.dll to the Cargo directory and output changes to:

cc1.exe: fatal error: Files/mingw/include: No such file or directory compilation terminated.
thread '<main>' panicked at 'explicit panic', C:\Users\sharp_000\.cargo\registry\src\github.com-88ac128001ac3a9a\gcc-0.3.25\src\lib.rs:818
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Deleting the target directory before building doesn't help.


Solution

  • Which Rust edition are you using? I had the same problem with the Rust MSVC edition.

    I installed GCC with MSYS2 and changed Rust to the GNU edition, added gcc to my PATH and everything was OK.