【发布时间】:2020-04-15 14:42:37
【问题描述】:
我正在尝试关注 100 days of Rust, day 12 并使用简单的 Actix 网络服务器失败。这是我到目前为止的代码(从博客复制并粘贴):
Cargo.toml
[package]
name = "blog-comments-rust"
version = "0.1.0"
authors = ["stwissel <stw@linux.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix-web = "2.0.0"
actix-rt = "1.1.0"
main.rs
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
async fn index() -> impl Responder {
HttpResponse::Ok().body("hello world!")
}
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| App::new().route("/", web::get().to(index)))
.bind("127.0.0.1:8000")?
.run()
.await
}
当我使用 cargo run 运行它时,编译器会尝试编译依赖项,但在许多模块上都失败了:
- backtrace-sys v0.1.35
- brotli-sys v0.3.2
两者都有相同的错误:
cargo:warning=dyld: Library not loaded: /usr/local/lib/libwep
cargo:warning= Referenced from: /usr/bin/cc
cargo:warning= Reason: no suitable image found. Did find:
cargo:warning= /usr/local/lib/libwep: code signature in (/usr/local/lib/libwep) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
cargo:warning= /usr/local/lib/libwep: stat() failed with errno=1
signal: 6
--- stderr
dyld: Library not loaded: /usr/local/lib/libwep
Referenced from: /usr/bin/git
Reason: no suitable image found. Did find:
/usr/local/lib/libwep: code signature in (/usr/local/lib/libwep) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
/usr/local/lib/libwep: stat() failed with errno=1
我相信这是 macOS 问题,而不是 Rust 问题。我正在使用 macOS 10.14.6。我的libwep参数:
- 403,776 字节(磁盘上 406 KB)
- 创建/修改 2017 年 1 月 27 日 07:40
ls -la libwep
-rwxr-xr-x 1 root wheel 403776 Jan 27 2017 libwep
我可以做些什么来编译我的代码?
【问题讨论】:
-
听起来
libwep是公司在员工计算机上安装的“安全”工具之一,并且尚未正确更新。 -
我认为你是对的。它注入了一切。见this。