DCIT / perl-CryptX

https://metacpan.org/pod/CryptX
Other
34 stars 23 forks source link

Build failure on MSYS2 due to `asm` block #102

Closed LordAro closed 2 months ago

LordAro commented 5 months ago

I'm getting a build failure in MSYS:

$ gmake
cd src && gmake CC="gcc" CFLAGS=" -std=c99 -DWIN32 -DWIN64 -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields   -Os  -msse4.1 -maes"
gmake[1]: Entering directory 'C:/Users/cpigott/dev/perl-CryptX/src'
gcc -Iltm -Iltc/headers -DLTC_SOURCE -DLTC_NO_TEST -DLTC_NO_PROTOTYPES -DLTM_DESC -std=c99 -DWIN32 -DWIN64 -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields   -Os  -msse4.1 -maes -DARGTYPE=4 -c ltc/ciphers/aes/aes_desc.c -o ltc/ciphers/aes/aes_desc.o
ltc/ciphers/aes/aes_desc.c: In function 's_aesni_is_supported':
ltc/ciphers/aes/aes_desc.c:65:7: error: 'asm' undeclared (first use in this function)
   65 |       asm volatile ("cpuid"
      |       ^~~
ltc/ciphers/aes/aes_desc.c:65:7: note: each undeclared identifier is reported only once for each function it appears in
ltc/ciphers/aes/aes_desc.c:65:10: error: expected ';' before 'volatile'
   65 |       asm volatile ("cpuid"
      |          ^~~~~~~~~
      |          ;
gmake[1]: *** [makefile:199: ltc/ciphers/aes/aes_desc.o] Error 1
gmake[1]: Leaving directory 'C:/Users/cpigott/dev/perl-CryptX/src'
gmake: *** [makefile:1642: src/liballinone.a] Error 2

I'm not quite sure how it hasn't been an issue before, maybe something to do with gcc 14?

$ perl --version
This is perl 5, version 39, subversion 10 (v5.39.10) built for MSWin32-x64-multi-thread
...
$ gcc --version
gcc.exe (Rev3, Built by MSYS2 project) 14.1.0
...

As suggested by https://stackoverflow.com/questions/35131350/error-asm-undeclared-first-use-in-this-function, swapping out -std=c99 with -std=gnu99 in the generated makefile means I can get the build to complete. I'm not sure how to do that in Makefile.PL. But you might want to fix the asm blocks to be more standard anyway.

LordAro commented 5 months ago

Doesn't seem to be gcc related - also fails with gcc 13.1 that's distributed with strawberryperl