9

On my previous, Intel-based Mac, I used to include

export ARCHFLAGS="-arch x86_64"

in my shell resource file. What's the correct compilation flag on the new ARM-based Apple silicon? arm? arm64? arm-64? arm_64? There doesn't seem to be a lot of resources out there yet, any pointers greatly appreciated!

thomax
  • 9,213
  • 3
  • 49
  • 68

2 Answers2

11

There's a long discussion over here on this topic. Long story short, they're agreeing on trusting uname -m to provide the correct architecture name.

This returns arm64, and given lack of evidence to the contrary, is probably the correct value.

thomax
  • 9,213
  • 3
  • 49
  • 68
  • `$ uname -m` returns `arm64` does it make sense to set it in .bashrc/.zshrc? `export ARCHFLAGS="-arch x86_64" # or what is the correct value for m2?` – StriveForBest Jun 12 '23 at 18:06
1

On my Mac silicon with an M2 processor, uname -m yields aarch64 and not arm64. This is also reflected under Ubuntu installed as a VM in the filesystem structure with directories /usr/include/aarch64-linux-gnu and /usr/lib/aarch64-linux-gnu

Correction: this is under Ubuntu as a VM on a Mac with a M2 processor. ON Mac itself, it does yield arm64

Jacques
  • 991
  • 1
  • 12
  • 15
  • Interesting. My M1 MacBook Pro still returns arm64 for uname -m, so it seems this value isn't consistent across all macs with the M* architecture. – thomax May 31 '23 at 17:57
  • Correction. I was talking under Ubuntu as a VM, but you are correct. On the Mac itself, which I just did, `uname -m` does produce `arm64` – Jacques Jun 01 '23 at 20:21