Search code examples
c++ccompiler-errorscompilation

Why does march=native not work on Apple M1?


Whenever I try to compile any C++ program with march=native on a Macbook with a M1 chip, I get the following error when using clang:

clang: error: the clang compiler does not support '-march=native'

However, it used to work on an older Macbook with an Intel CPU. Does clang not support this architecture (yet)?

clang --version gives:

Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: arm64-apple-darwin20.2.0

Solution

  • In Apple clang version 13.0.0, -mcpu=apple-m1 is now available.