I have a basic C program:
#include <stdio.h>
int main() {
printf("Hello, world!\n");
}
When I compile this directly using cc
on an Apple Silicon device, it produces an arm64
executable:
% cc hello.c -o hello
% file hello
hello: Mach-O 64-bit executable arm64
% ./hello
Hello, world!
However, when I build it through a build system such as CMake or Ninja, it produces an x86_64 binary:
% ./my-build-system
% file hello
hello: Mach-O 64-bit executable x86_64
I've verified that the command that the build script is running is identical to the one that I run myself. If I copy and paste the command and run it myself, the produced executable is again arm64.