【发布时间】:2021-03-29 09:08:55
【问题描述】:
如何在 macOS 11 (Intel) 上编译 C 项目以在 Silicon 上运行?
我当前的构建脚本很简单:
./configure
make
sudo make install
我尝试将--host 和--target 标志与aarch64-apple-darwin 和arm-apple-darwin 一起使用,但没有任何运气。
二进制始终默认为x86_64:
> file foobar.so
foobar.so: Mach-O 64-bit bundle x86_64
更新:
指定--host 时似乎找不到cc 和gcc。
checking for arm-apple-darwin-cc... no
checking for arm-apple-darwin-gcc... no
【问题讨论】:
-
您安装了最新的 XCode 12?您至少需要它。
-
@selbie:这在 GitHub 操作上运行,Xcode 版本为 12.2。
-
在下面查看我的答案。您可能想要
-target arm64-apple-macos11。请注意,目标参数前面有一个单破折号,而不是双破折号。 -
你有没有让它为 arm 编译?
-
不,我们最终租了一台 MacStadium M1 机器,但仍然需要在 x84 上为 arm 编译这个 ????♂️
标签: c macos arm autotools apple-silicon