Невозможно скомпилировать Actix в MacOS Mojave из-за "ar crs" "некорректного объекта (неизвестная команда загрузки 1)" - PullRequest
0 голосов
/ 13 октября 2018

Я не могу скомпилировать базовый пример с использованием Actix.Я подозреваю, что мне не хватает некоторых библиотек, но я понятия не имею, что это может быть.Я также обновился до Mojave несколько дней назад, но я не уверен, что это связано.

Кажется, что он жалуется на ar crs и на внутреннюю ошибку, происходящую в ranlib при выполнении этой команды.

main.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).

Завершение обратная трассировка слишком велика для включения в переполнение стека.

Ответы [ 2 ]

0 голосов
/ 15 марта 2019

У меня была такая же ошибка.

Когда я заменил cctools 855 на 921 из этого крана, тогда cargo build сработало: https://github.com/dgsga/homebrew-cctools

brew unlink cctools
brew tap dgsga/cctools
brew install dgsga/cctools/mtoc

Мохаве 10.14.3, Rust 1.33.0, actix-web 0.7.18

0 голосов
/ 27 октября 2018

Кажется, что он работает после установки cctools через MacPorts.

По какой-то причине установка его через brew, похоже, не сработала.

...