Build liboqs for MacOS arm64 on MacOS x64
Hi
I've tried to build liboqs for arm64 MacOS in a intel MacOS. The main purpose is to build later Chromium for that arm64 architecture, but it will apply to other purposes also. I used the proper parameter -DCMAKE_OSX_ARCHITECTURES=arm64 in the following command:
cmake .. -G"Ninja" -DCMAKE_INSTALL_PREFIX=$CHROMIUM_ROOT/third_party/boringssl/src/oqs -DOQS_USE_OPENSSL=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_OSX_ARCHITECTURES=arm64
but when I run ninja I'm having errors as if the code wasn't ready to support this arm64 architecture.
Code would have to be adapted to be valid for that architecture.
I think that the problem are these headers shouldn't be used in arm64 architectures according to link:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wmmintrin.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/emmintrin.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/xmmintrin.h
Once removed, other parts of the code have to be changed also to fix code, such as aes128_ni.c or aes256_ni.c
Created this Issue as suggested here
I'm a little out of my depth when it comes to the intricacies of building the library on a Mac, but perhaps this could this be fixed with an appropriate CMake toolchain file, similarly to the way we handle cross-compiling for ARM on an x86_64 Linux machine?