DCIT / perl-CryptX

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

Build fails on i686 #57

Closed newbluemoon closed 5 years ago

newbluemoon commented 5 years ago

I tried building perl-CryptX for i686 and ran into the following error:

...
cc -Iltm -Iltc/headers -DLTC_SOURCE -DLTC_NO_TEST -DLTC_NO_PROTOTYPES -DLTM_DESC -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=i686 -O2 -pipe   -g -D_FILE_OFFSET_BITS=64 -DLARGE_FILE_SUPPORT64   -fPIC  -Wall -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=i686 -O2 -pipe   -g -D_FILE_OFFSET_BITS=64 -DLARGE_FILE_SUPPORT64   -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=i686 -O2 -pipe    -I/usr/include     -DARGTYPE=4 -c ltc/hashes/blake2b.c -o ltc/hashes/blake2b.o
ltc/hashes/blake2b.c: In function 'blake2b_compress':
ltc/hashes/blake2b.c:351:1: warning: unsupported size for integer register
  351 | }
      | ^
ltc/hashes/blake2b.c:351:1: warning: unsupported size for integer register
...
ltc/headers/tomcrypt_macros.h: ltc/hashes/blake2b.c:351:1: warning: unsupported size for integer register
Assembler messages:
ltc/headers/tomcrypt_macros.h:393: Error: invalid instruction suffix for `ror'
ltc/hashes/blake2b.c:351:1: warning: unsupported size for integer register
...
make[1]: *** [Makefile:197: ltc/hashes/blake2b.o] Error 1
make[1]: Leaving directory '/builddir/CryptX-0.065/src'
make: *** [Makefile:1923: src/liballinone.a] Error 2

I think the error was introduced in commit 32f1d210ed6300b8e82f46f1b983f7316aa7eaf9. After some digging I might have found the culprit: line 381 in src/ltc/headers/tomcrypt_macros.h allows 64-bit rotation for i386 targets. Perhaps it is just a copy-and-paste error? ;)

The following patch (which just removes the __i386__ condition) allows the build to finish:

--- src/ltc/headers/tomcrypt_macros.h.orig      2019-10-08 14:25:41.000000000 +0200
+++ src/ltc/headers/tomcrypt_macros.h   2019-10-20 09:03:21.352042592 +0200
@@ -378,7 +378,7 @@
 #define ROR64c(x,n) ROR64(x,n)
 #define ROL64c(x,n) ROL64(x,n)

-#elif !defined(__STRICT_ANSI__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && !defined(INTEL_CC) && !defined(LTC_NO_ASM)
+#elif !defined(__STRICT_ANSI__) && defined(__GNUC__) && defined(__x86_64__) && !defined(INTEL_CC) && !defined(LTC_NO_ASM)

 static inline ulong64 ROL64(ulong64 word, int i)
 {
karel-m commented 5 years ago

fixed in v0.066

newbluemoon commented 5 years ago

Thank you! :)