在 m1 mac 上交叉编译 c 程序到 x86_64 linux

问题描述 投票:0回答:1

我尝试在我的 m1 mac 上为 x86-64 linux 编译一个 C 程序,这是我使用的命令

clang --target=x86_64-unknown-linux-gnu test.c

但是我收到一个错误

fatal error: 'stdio.h' file not found
.

我似乎错过了一些 x86-64 linux 的 dylib 文件。有没有人如何解决它?

c linux clang cross-compiling apple-m1
1个回答
0
投票

快速解决方案 - 安装预构建交叉编译器二进制文件

brew tap SergioBenitez/osxct
brew install x86_64-unknown-linux-gnu
© www.soinside.com 2019 - 2024. All rights reserved.