gpt4 book ai didi

linux - 在 Mac OSX 上交叉编译到 x86_64-unknown-linux-gnu 失败

转载 作者:行者123 更新时间:2023-12-04 04:27:39 39 4
gpt4 key购买 nike

我尝试将我的 Rust 项目之一编译到 x86_64-unknown-linux-gnu 目标:

$ cargo build --target=x86_64-unknown-linux-gnu
Compiling deployer v0.1.0 (file:///Users/raphael/web/deployer)
error: linking with `cc` failed: exit code: 1
|
= note: "cc"
= note: clang: warning: argument unused during compilation: '-pie'
ld: unknown option: --as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我不知道如何处理这样的消息。我该怎么做才能让它发挥作用?

这是我的 Cargo.toml文件:
[package]
name = "deployer"
version = "0.1.0"
authors = ["..."]

[dependencies]
clap = "2.14.0"
time = "0.1.35"
slack-hook = "0.2"

cargo 版本:

cargo 0.13.0-nightly (109cb7c 2016-08-19)

rust 版:

rustc 1.12.0 (3191fbae9 2016-09-23)

我试图用 rustup 更新所有内容,但我仍然遇到同样的问题。

最佳答案

灵感来自 cross-compile-rust-from-mac-to-linux ,我通常安装这些依赖项来交叉编译从 Mac OS 到 Linux 的 Rust(例如对于 Docker 容器):

rustup target add x86_64-unknown-linux-gnu

# Install a pre-built cross compiler
brew tap SergioBenitez/osxct
brew install x86_64-unknown-linux-gnu
最后我可以在 Mac OS 上交叉编译到 Linux:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-unknown-linux-gnu-gcc \
cargo build --target=x86_64-unknown-linux-gnu

关于linux - 在 Mac OSX 上交叉编译到 x86_64-unknown-linux-gnu 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40424255/

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