liboqs icon indicating copy to clipboard operation
liboqs copied to clipboard

Build liboqs for MacOS arm64 on MacOS x64

Open ivcantero opened this issue 1 year ago • 1 comments

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

image

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.

image image image

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

ivcantero avatar Nov 02 '24 21:11 ivcantero

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?

SWilson4 avatar Nov 04 '24 15:11 SWilson4