encryptogroup / OTExtension

C++ OT extension implementation
GNU Lesser General Public License v3.0
125 stars 35 forks source link

relic error #42

Open hros opened 2 years ago

hros commented 2 years ago

building OTExtension downloads relic version 0.5.0, and during compilation (on Ubuntu 22.04) fails with the following error:

[ 76%] Building C object extern/ENCRYPTO_utils/extern/relic/src/CMakeFiles/relic_s.dir/md/blake2s-ref.c.o
In file included from /tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2s-ref.c:18:
/tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2.h:101:5: error: size of array element is not a multiple of its alignment
  101 |     blake2s_state S[8][1];
      |     ^~~~~~~~~~~~~
/tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2.h:102:5: error: size of array element is not a multiple of its alignment
  102 |     blake2s_state R[1];
      |     ^~~~~~~~~~~~~
/tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2.h:109:5: error: size of array element is not a multiple of its alignment
  109 |     blake2b_state S[4][1];
      |     ^~~~~~~~~~~~~
/tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2.h:110:5: error: size of array element is not a multiple of its alignment
  110 |     blake2b_state R[1];
      |     ^~~~~~~~~~~~~
/tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2s-ref.c: In function ‘blake2s’:
/tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2s-ref.c:329:3: error: size of array element is not a multiple of its alignment
  329 |   blake2s_state S[1];
      |   ^~~~~~~~~~~~~
gmake[2]: *** [extern/ENCRYPTO_utils/extern/relic/src/CMakeFiles/relic_s.dir/build.make:846: extern/ENCRYPTO_utils/extern/relic/src/CMakeFiles/relic_s.dir/md/blake2s-ref.c.o] Error 1

please either update the relic version being downloaded, or add instructions how to do so manually

hros commented 2 years ago

An alternative is building ENCRYPTO_utils locally, which successfully compiles a recent version or relic.

I am trying not to modify any files from these projects, only specify external parameters and environment variables.

However, I am having difficulties in specifying the correct cmake command line options so that the find_package(ENCRYPTO_utils QUIET) command would succeed.

If I add -DENCRYPTO_utils_DIR=<path to ENCRYPTO_utils_inst>, then cmake finds the config package:

get_filename_component(ENCRYPTO_utils_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)

list(APPEND CMAKE_MODULE_PATH "${ENCRYPTO_utils_CMAKE_DIR}")

include(CMakeFindDependencyMacro)

find_dependency(GMP)
find_dependency(GMPXX)
find_dependency(OpenSSL)

if(NOT TARGET ENCRYPTO_utils::encrypto_utils)
    include("${ENCRYPTO_utils_CMAKE_DIR}/ENCRYPTO_utilsTargets.cmake")
endif()

but initially fails on find_package(GMP), since Ubuntu's libgmp-dev does not provide a gmpConfig.cmake file. I've tried setting GMP_LIB, GMP_INC environment variables, but that did not help.

If I comment out that line (to see what else fails...), the next error is on the line include("${ENCRYPTO_utils_CMAKE_DIR}/ENCRYPTO_utilsTargets.cmake") with the error: include could not find requested file. The file ENCRYPTO_utilsTargets.cmake does exist in <path to ENCRYPTO_utils_inst>/src but I could not get cmake to load it

hros commented 2 years ago

building OTExtension downloads relic version 0.5.0, and during compilation (on Ubuntu 22.04) fails with the following error:

[ 76%] Building C object extern/ENCRYPTO_utils/extern/relic/src/CMakeFiles/relic_s.dir/md/blake2s-ref.c.o
In file included from /tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2s-ref.c:18:
/tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2.h:101:5: error: size of array element is not a multiple of its alignment
  101 |     blake2s_state S[8][1];
      |     ^~~~~~~~~~~~~
/tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2.h:102:5: error: size of array element is not a multiple of its alignment
  102 |     blake2s_state R[1];
      |     ^~~~~~~~~~~~~
/tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2.h:109:5: error: size of array element is not a multiple of its alignment
  109 |     blake2b_state S[4][1];
      |     ^~~~~~~~~~~~~
/tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2.h:110:5: error: size of array element is not a multiple of its alignment
  110 |     blake2b_state R[1];
      |     ^~~~~~~~~~~~~
/tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2s-ref.c: In function ‘blake2s’:
/tmp/OTExtension/extern/ENCRYPTO_utils/extern/relic/src/md/blake2s-ref.c:329:3: error: size of array element is not a multiple of its alignment
  329 |   blake2s_state S[1];
      |   ^~~~~~~~~~~~~
gmake[2]: *** [extern/ENCRYPTO_utils/extern/relic/src/CMakeFiles/relic_s.dir/build.make:846: extern/ENCRYPTO_utils/extern/relic/src/CMakeFiles/relic_s.dir/md/blake2s-ref.c.o] Error 1

please either update the relic version being downloaded, or add instructions how to do so manually

Relic has a new release: tag 0.6.0 Please update the relic submodule

Steffi-Roy commented 2 years ago

Hey! were you able to resolve the issue? Tried different things but still stuck at this error

Xenooooooooo commented 1 year ago

Problem Solved.

My compilation is under Ubuntu VM with GCC 11.3.

You have to revise .../extern/ENCRYPTO_utils/extern/relic/src/md/blake2.h

In line 64 ad 89, the struct is defined with ALIGNME( 64 ) typedef struct, replace it with typedef struct ALIGNME( 64 ), save and rebuild the project is OK for me.

image