无法在 Windows 上构建 Iron hello world

Can't build Iron hello world on Windows

我正在尝试构建 Iron hello world example,但 OpenSSL 有问题。

我的 OS 是 Windows 1,我已经尝试了 Rust stable (1.7) 和 nightly (1.9)。

我已经 installed OpenSSL with mingw 并设置了环境变量 OPENSSL_LIB_DIROPENSSL_INCLUDE_DIR。为了以防万一,我已经将路径添加到 PATH 变量。 None 这些更改解决了问题。

Cargo 的输出就像这个问题: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

我将 include/openssl 目录、libssl32.dlllibeay32.dll 复制到 Cargo 目录并将更改输出到:

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.

在构建之前删除 target 目录没有帮助。

您使用的是哪个 Rust 版本?我在使用 Rust MSVC 版本时遇到了同样的问题。

我用 MSYS2 安装了 GCC 并将 Rust 更改为 GNU 版本,将 gcc 添加到我的 PATH 并且一切正常。