在我的货物文件中添加 SSL 依赖项时,我无法构建我的 Rust 项目。这对 Windows 来说并不陌生,但我想解决这个问题,以便我可以使用 Powershell 和本机 Windows 开发来处理我的 Rust 项目。
有问题的依赖如下:
[dependencies.ws]
version = "0.8.0"
features = ["ssl"]
Run Code Online (Sandbox Code Playgroud)
当我运行 时cargo build,我在 Windows 上遇到很多关于 SSL 的错误,所以让我们开始逐步调试。
第一个错误:
PS C:\Users\sam\vcs\project> cargo build
Compiling openssl-sys v0.9.43
error: failed to run custom build command for `openssl-sys v0.9.43`
process didn't exit successfully: `C:\Users\sam\vcs\project\target\debug\build\openssl-sys-d964f46e4c48d206\build-script-main` (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR
X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR
X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR
X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
note: vcpkg did …Run Code Online (Sandbox Code Playgroud) 我想将cargo-apk 安装cargo install cargo-apk到我的系统(Linux Mint),但出现此错误
error: failed to run custom build command for `openssl v0.9.24`
Caused by:
process didn't exit successfully: `/tmp/cargo-install7N44TO/release/build/openssl-65bb03053b1fc095/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to detect OpenSSL version', /home/jiri/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/build.rs:16:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-apk v0.4.0`, intermediate artifacts can be found at `/tmp/cargo-install7N44TO`
Caused by:
build failed
Run Code Online (Sandbox Code Playgroud)
我发现我应该安装 libssl-dev,所以我安装了,但没有帮助。
我刚刚在Rust项目中添加了一个外部包:
[dependencies]
feed = "2.0"
Run Code Online (Sandbox Code Playgroud)
这个箱子有几个依赖关系,特别是openssl-sys v0.9.10.当我尝试构建我的项目时,这个失败了:
$ cargo build
Compiling unicode-normalization v0.1.4
Compiling openssl-probe v0.1.0
Compiling matches v0.1.4
Compiling log v0.3.7
Compiling unicode-bidi v0.2.5
Compiling libc v0.2.21
Compiling quick-xml v0.4.2
Compiling pkg-config v0.3.9
Compiling rss v0.4.0
Compiling idna v0.1.1
Compiling time v0.1.36
Compiling num-traits v0.1.37
Compiling gcc v0.3.45
Compiling num-integer v0.1.34
Compiling url v1.4.0
Compiling num-iter v0.1.33
Compiling num v0.1.37
Compiling chrono v0.3.0
Compiling openssl-sys v0.9.10
Compiling libz-sys v1.0.13
error: failed to run custom build command for …Run Code Online (Sandbox Code Playgroud)