relic-toolkit / relic

Code
Other
458 stars 179 forks source link

Problem with aarch64 #251

Closed mialuyao closed 1 year ago

mialuyao commented 2 years ago

I'm trying to compile relic library on Linux ubuntu 5.15.0-52-generic aarch64. When the compilation I received this error:

libscapi/build/OTExtensionEncrypto/extern/ENCRYPTO_utils/extern/relic/src/arch/relic_arch_x64.c:43:49: error: unknown register name ‘%rdx’ in ‘asm’
   43 | #define asm                                     __asm__ volatile
      |                                                 ^~~~~~~
libscapi/build/OTExtensionEncrypto/extern/ENCRYPTO_utils/extern/relic/src/arch/relic_arch_x64.c:43:49: error: unknown register name ‘%rcx’ in ‘asm’
   43 | #define asm                                     __asm__ volatile
      |                                                 ^~~~~~~
libscapi/build/OTExtensionEncrypto/extern/ENCRYPTO_utils/extern/relic/src/arch/relic_arch_x64.c:43:49: error: unknown register name ‘%rbx’ in ‘asm’
   43 | #define asm                                     __asm__ volatile
      |                                                 ^~~~~~~

How to fix this problem? Thank you!

dfaranha commented 2 years ago

You should try changing the configuration to ARCH=A64 for aarch64 support.

mialuyao commented 2 years ago

You should try changing the configuration to ARCH=A64 for aarch64 support.

I got what your mean. I'm ashamed that I'm a beginner in programming. I try to add SET(CMAKE_SYSTEM_PROCESSOR A64) in CMakelists.txt, which is invalid. And I have no idea how to change the configuration to ARCH=64. Besides, I got the warning as

CMake Warning (dev) in extern/ENCRYPTO_utils/CMakeLists.txt:
  Policy CMP0111 is not set: An imported target missing its location property
  fails during generation.  Run "cmake --help-policy CMP0111" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  IMPORTED_LOCATION not set for imported target "Boost::thread".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in extern/ENCRYPTO_utils/CMakeLists.txt:
  Policy CMP0111 is not set: An imported target missing its location property
  fails during generation.  Run "cmake --help-policy CMP0111" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  IMPORTED_LOCATION not set for imported target "Boost::thread".
This warning is for project developers.  Use -Wno-dev to suppress it.

Is this warning related? Could you give me some instructions? Thank you very much!

mialuyao commented 2 years ago

I use ubuntu based on mac m1

dfaranha commented 2 years ago

Don't worry, RELIC's usability is nothing to write home about.

You should execute cmake -DARCH=A64 <build_dir> to set the target architecture to Aarch64 in your build directory. It should have been detected automatically, but Aarch64 support is recent and might still be buggy.

dfaranha commented 1 year ago

I assume problems were solved, so closing it for now.