afritz1/OpenTESArena

-march=native not supported on Apple M1

Closed this issue · 4 comments

When attempting to build from source on apple silicon, the error is returned:

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

This is fixed by changing -march=native to -mcpu=apple-m1 in the CMakeLists.txt file

Is apple-m1 still the correct value if using an M2 processor?

I get that same error on my M1 Mac and I use that same change. It'd be good to detect in CMakeLists.txt if the system is Apple and ARM64.

Is apple-m1 still the correct value if using an M2 processor?

A quick search didn't reveal much, but -mcpu=apple-m1 should be okay until it becomes an issue. I think newer Clang versions allow -march=native.

I tried compiling again on my Mac and -march=native worked fine, not sure if this issue can be closed yet though.

Compiled again recently on M1 with no issue, although Jolt complained about -Ofast in ReleaseNative so I had to change that to -O3, not a big deal.