且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么 March=native 在 Apple M1 上不起作用?

更新时间:2023-01-11 12:33:56

据我所知,这不是 Apple M1 特定的,它也发生在用于各种其他架构的 clang(主要是各种其他 arm处理器).例如在此处查看此错误报告 https://github.com/DMOJ/judge-server/issues/303

As far as I know this is not Apple M1 specific, it occurs also with clang for various other architectures (mostly various other arm processors). e.g. See this bug report here https://github.com/DMOJ/judge-server/issues/303

基本上每个新架构的 clang 构建都必须选择为march=native"提供默认值;对于编译器构建与否的目标;如果没有,那么您将看到此错误消息.即使对于那些确实有优化目标的 arm 处理器,您通常也必须专门使用-mcpu=xxx";而不是-march".

Basically every build of clang for a new architecture must choose to provide defaults for "march=native" for the target for which the compiler is built or not; and if not then you will see this error message. Even for those arm processors who do have optimisation targets you often have to use specifically "-mcpu=xxx" instead of "-march".

例如对于 iphone,您将使用 -mcpu=apple-a11 -mcpu=apple-a12 等.

e.g. For the iphone you would use -mcpu=apple-a11 -mcpu=apple-a12 etc.

然而,Apple M1