rust 从ARM macOS交叉编译到Linux?

eagi6jfj  于 2023-05-22  发布在  Mac
关注(0)|答案(1)|浏览(221)

我有一些麻烦让我的编译从苹果硅-> x86 linux工作。我用这个命令编译:

cargo build --release --target=x86_64-unknown-linux-gnu

我安装了这些目标:

aarch64-apple-darwin (installed)
x86_64-apple-darwin (installed)
x86_64-pc-windows-gnu (installed)
x86_64-unknown-linux-gnu (installed)

我正在使用homebrew的gcc(brew install gcc),我有这个.cargo/config文件:

[target.x86_64-unknown-linux-gnu]
linker = "/opt/homebrew/bin/gcc-13"

我得到这个输出:

error: linking with `/opt/homebrew/bin/gcc-13` failed: exit status: 1
= note: ld: unknown option: --as-needed
          collect2: error: ld returned 1 exit status

有人能看出我的配置有什么明显的错误吗?
谢谢

piwo6bdm

piwo6bdm1#

我还没有在我的机器上尝试过以下内容,但是你可以安装并尝试zig

[target.x86_64-unknown-linux-gnu]
linker = "zig cc -target x86_64-unknown-linux-gnu"

相关问题