Rust OpenSSL编译报错问题

在actix-web中使用openssl:

1
2
3
[dependencies]
actix-web = {<!-- --> version = "3", features = ["openssl"] }
openssl = {<!-- --> version="0.10" }

cargo build编译报错如下:
error: failed to run custom build command for openssl-sys v0.9.55

需要安装windows平台的openssl:

  • 下载地址:https://slproweb.com/download/Win64OpenSSL-1_0_2u.exe
  • 点击安装:安装位置:C:\Program Files\OpenSSL-Win64\
  • 配置环境变量:OPENSSL_DIR=C:\Program Files\OpenSSL-Win64\

再次编译即可。