gpt4 book ai didi

rust - 由于 "ar crs" "malformed object (unknown load command 1)",无法在 macOS Mojave 上编译 Actix

转载 作者:行者123 更新时间:2023-11-29 08:20:24 27 4
gpt4 key购买 nike

我无法使用 Actix 编译基本示例。我怀疑我可能缺少一些库,但我不知道它可能是什么。我前几天也升级到 Mojave,但我不确定这是否相关。

它似乎提示 ar crs 和运行此命令时 ranlib 中发生的内部错误。

主要.rs:

extern crate actix_web;
use actix_web::{server, App, HttpRequest};

fn index(_req: &HttpRequest) -> &'static str {
"Hello world!"
}

fn main() {
server::new(|| App::new().resource("/", |r| r.f(index)))
.bind("127.0.0.1:8088")
.unwrap()
.run();
}

cargo .toml:

actix-web = "0.7.8"

我获得的回溯:

    mbp-de-matthieu:hello-world matthieu$ RUST_BACKTRACE=1 cargo build
Compiling backtrace-sys v0.1.24
Compiling miniz-sys v0.1.10
Compiling brotli-sys v0.3.2
Compiling ring v0.13.2
Compiling tokio-current-thread v0.1.3
error: failed to run custom build command for `miniz-sys v0.1.10`
process didn't exit successfully: `/Users/matthieu/Documents/Rust/actix/hello-world/target/debug/build/miniz-sys-dc81523acb01e9e7/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/Users/matthieu/Documents/Rust/actix/hello-world/target/debug/build/miniz-sys-d59b36acd5b3db67/out/miniz.o" "-c" "miniz.c"
exit code: 0
AR_x86_64-apple-darwin = None
AR_x86_64_apple_darwin = None
HOST_AR = None
AR = None
running: "ar" "crs" "/Users/matthieu/Documents/Rust/actix/hello-world/target/debug/build/miniz-sys-d59b36acd5b3db67/out/libminiz.a" "/Users/matthieu/Documents/Rust/actix/hello-world/target/debug/build/miniz-sys-d59b36acd5b3db67/out/miniz.o"
cargo:warning=/usr/local/Cellar/cctools/855/bin/ranlib: object: /Users/matthieu/Documents/Rust/actix/hello-world/target/debug/build/miniz-sys-d59b36acd5b3db67/out/libminiz.a(miniz.o) malformed object (unknown load command 1)
cargo:warning=ar: internal ranlib command failed
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "ar" "crs" "/Users/matthieu/Documents/Rust/actix/hello-world/target/debug/build/miniz-sys-d59b36acd5b3db67/out/libminiz.a" "/Users/matthieu/Documents/Rust/actix/hello-world/target/debug/build/miniz-sys-d59b36acd5b3db67/out/miniz.o" with args "ar" did not execute successfully (status code exit code: 1).

complete backtrace太大而无法包含在 Stack Overflow 中。

最佳答案

通过 MacPorts 安装 cctools 后似乎可以工作。

由于某些原因,通过 brew 安装它似乎不起作用。

关于rust - 由于 "ar crs" "malformed object (unknown load command 1)",无法在 macOS Mojave 上编译 Actix,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52794353/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com