aces / Loris-MRI

The set of scripts that preprocess and insert MRI data into the database.
10 stars 50 forks source link

CPAN Digest::BLAKE2 not compatible with gcc11 / Ubuntu22 #1112

Closed laemtl closed 1 month ago

laemtl commented 2 months ago

While trying to install Digest::BLAKE2 sudo -S cpan install Digest::BLAKE2

I got the following error:

In file included from src/../blake2/sse/blake2b.c:18,
                 from lib/Digest/BLAKE2b.xs:10:
src/../blake2/sse/blake2.h:101:5: error: size of array element is not a multiple of its alignment
  101 |     blake2s_state S[8][1];
      |     ^~~~~~~~~~~~~
src/../blake2/sse/blake2.h:102:5: error: size of array element is not a multiple of its alignment
  102 |     blake2s_state R[1];
      |     ^~~~~~~~~~~~~
src/../blake2/sse/blake2.h:109:5: error: size of array element is not a multiple of its alignment
  109 |     blake2b_state S[4][1];
      |     ^~~~~~~~~~~~~
src/../blake2/sse/blake2.h:110:5: error: size of array element is not a multiple of its alignment
  110 |     blake2b_state R[1];
      |     ^~~~~~~~~~~~~
In file included from lib/Digest/BLAKE2b.xs:10:
src/../blake2/sse/blake2b.c: In function ‘blake2b’:
src/../blake2/sse/blake2b.c:371:3: error: size of array element is not a multiple of its alignment
  371 |   blake2b_state S[1];
      |   ^~~~~~~~~~~~~
lib/Digest/BLAKE2b.c: In function ‘XS_Digest__BLAKE2b_new’:
lib/Digest/BLAKE2b.c:242:17: warning: unused variable ‘class’ [-Wunused-variable]
  242 |         SV *    class = ST(0)

This package is a dependency of the PET pipeline.

gsch-cmi commented 1 month ago

You can patch a local version of Digest::BLAKE2 that can be installed locally, the fix is quite minor, and is detailed here: https://github.com/Raptor3um/raptoreum/issues/48#issuecomment-969125200

effectively all lines that begin with ALIGNME( 64 ) in blake2.h need ALIGNME(64) moved to the middle of the line, e.g. typedef struct ALIGNME( 64 ) __blake2s_state

i've attached the a tar.gz of the patch i made by making the above change throughout in case it is helpful. it installs in ubuntu 22 and 24 docker containers using cpanm. Digest-BLAKE2-0.02.tar.gz

laemtl commented 1 month ago

Thank you @gsch-cmi , I have implemented your fix in https://github.com/aces/Loris-MRI/pull/1135