open-quantum-safe / liboqs

C library for prototyping and experimenting with quantum-resistant cryptography
https://openquantumsafe.org/
Other
1.78k stars 436 forks source link

Compilation fails on Apple M1 #946

Closed fxcoudert closed 3 years ago

fxcoudert commented 3 years ago

See build at https://github.com/Homebrew/homebrew-core/pull/73484

-- Found Threads: TRUE  
CMake Error at .CMake/gcc_clang_intrinsics.cmake:8 (message):
  .CMake/detect_gcc_clang_intrinsics.c returned exit code:
Call Stack (most recent call first):
  .CMake/compiler_opts.cmake:18 (include)
  CMakeLists.txt:49 (include)

The reason is that the Apple clang compiler does not support -march=native for arm64 (don't ask me why):

$ clang -arch arm64 a.c -fPIE -march=native
clang: error: the clang compiler does not support '-march=native'
jschanck commented 3 years ago

The tests currently run by gcc_clang_intrinsics.cmake are only meaningful on x86_64, so we can just disable them on arm64. I've added this to my portable build improvements branch https://github.com/open-quantum-safe/liboqs/pull/941/commits/b1a9f0cd67a8915246dec26a399e572e8a63f11c.

For now you should be able to compile with "-DOQS_USE_CPU_EXTENSIONS=OFF".

jschanck commented 3 years ago

@fxcoudert could you let us know if this is resolved on main (b36ff9f17c0239f3c0121d9eeaf9ac053df85467)?

jschanck commented 3 years ago

I'm going to close this. We've made significant changes to the relevant part of the build system since this report came in. If we're still failing on M1 it's not for the same reason, and we need a new report.

chenrui333 commented 3 years ago

Hi @jschanck 👋 it looks the new release still failed on 11-arm. I just opened a new issue tracker on this compilation problem. (#1018)