我在try 构建rust程序时遇到了错误failed to run custom build command for openssl-sys v0.9.60
.下面是主要的rs
和Cargo 汤姆
文件.
主要的rs
extern crate reqwest;
fn main() {
let mut resp = reqwest::get("http://www.governo.mg.gov.br/Institucional/Equipe").unwrap();
assert!(resp.status().is_success());
}
Cargo 汤姆
[package]
name = "get_sct"
version = "0.1.0"
authors = ["myname <myemail>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
reqwest = "0.10.10"
我在本地安装了openssl(如本question中所建议的),使用:
git clone git://git.openssl.org/openssl.git
cd openssl
./config --openssldir=/usr/local/ssl
make
make test
sudo make install
最后,我跑了export OPENSSL_DIR="/usr/local/ssl"
米
我注意到我已经有了openssl只水 Python ,这是我的默认路径.要将默认路径openssl更改为github安装,我运行了chmod -x MYPATH/anaconda3/bin/openssl
,现在which openssl
返回/usr/local/bin/openssl
.
我还安装了pkg-config个(如本question中所建议的).运行which pkg-config
返回/usr/bin/pkg-config
然而,当我再次运行cargo run
时,程序会打印相同的错误消息.以下是完整的错误消息:
> cargo run
Compiling openssl-sys v0.9.60
Compiling tokio v0.2.24
Compiling pin-project-internal v0.4.27
Compiling pin-project-internal v1.0.2
Compiling mime_guess v2.0.3
Compiling url v2.2.0
error: failed to run custom build command for `openssl-sys v0.9.60`
Caused by:
process didn't exit successfully: `/PACKAGEPATH/target/debug/build/openssl-sys-db18d493257de4f7/build-script-main` (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR = /usr/local/ssl
--- stderr
thread 'main' panicked at 'OpenSSL library directory does not exist: /usr/local/ssl/lib', /home/lucas/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.60/build/主要的rs:66:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build faile
看起来rust正在搜索/usr/local/ssl/lib
中的ssl.事实上,我的电脑里有一个/usr/local/ssl
文件夹,但没有lib
文件夹.
我做错了什么?如何使我在本地安装的openssl正确运行?