3 ms·
Both x86 and arm clang can output for the other architecture, or universal. Pass `-arch arm64` not `-march` You can also `clang -arch x86_64 -arch arm64` to b
by bacon_blood 6y ago
Both x86 and arm clang can output for the other architecture, or universal.
Pass `-arch arm64` not `-march`
You can also `clang -arch x86_64 -arch arm64` to build for both at once.
You can even go a step further and run your clang as native from bazel, via `arch -arm64 clang`.
Put it all together and you have: `arch -arm64 clang -arch x86_64 -arch arm64`.
It may seem like I'm joking but I'm not.
- shepmaster 6y agoRelated: Why does my native application compiled on Apple Silicon sometimes build as arm64 and sometimes build as x86_64? Why does my native arm64 application built using an x86_64 build system fail to be code signed unless I remove the previous executable? [1] https://stackoverflow.com/questions/64830635/why-does-my-native-application-compiled-on-apple-silicon-sometimes-build-as-arm6 https://stackoverflow.com/questions/64830635/why-does-my-nat... [2] https://stackoverflow.com/questions/64830671/why-does-my-native-arm64-application-built-using-an-x86-64-build-system-fail-to https://stackoverflow.com/questions/64830671/why-does-my-nat...
- deleted 6y ago[deleted]
- haberman 6y agoThanks for the tips. I'm unable to replicate my previous experiment re: -arch. When I compile a wrapper program that does an exec() of clang, it is able to build arm64 or x86_64 even if the wrapper is built as x86_64. The "arch" command is handy, thanks for that.