haskell-crypto / cryptonite

lowlevel set of cryptographic primitives for haskell
Other
226 stars 139 forks source link

Version 0.27 cannot be compiled if pclmuldq is specified #324

Closed kazu-yamamoto closed 4 years ago

kazu-yamamoto commented 4 years ago

On Linux on Haswell, I got the following error:

% cabal config -f support_pclmuldq
% cabal build
[135 of 135] Compiling Crypto.Tutorial  ( Crypto/Tutorial.hs, dist/build/Crypto/Tutorial.o )

In file included from cbits/aes/x86ni.h:38:0: error:
    0,
                     from cbits/aes/gf.c:35:

/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/wmmintrin.h:34:3: error:
     エラー: #error "AES/PCLMUL instructions not enabled"
     # error "AES/PCLMUL instructions not enabled"
       ^
   |
34 | # error "AES/PCLMUL instructions not enabled"
   |   ^

In file included from cbits/aes/x86ni.h:39:0: error:
    0,
                     from cbits/aes/gf.c:35:

/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/tmmintrin.h:31:3: error:
     エラー: #error "SSSE3 instruction set not enabled"
     # error "SSSE3 instruction set not enabled"
       ^
   |
31 | # error "SSSE3 instruction set not enabled"
   |   ^
`gcc' failed in phase `C Compiler'. (Exit code: 1)
cab: callCommand: cabal v1-build (exit 1): failed
kazu-yamamoto commented 4 years ago

Here is cpuinfo:

% cat /proc/cpuinfo | grep flags
flags       : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx hypervisor lahf_lm invpcid_single ssbd ibrs ibpb fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt spec_ctrl
kazu-yamamoto commented 4 years ago

If use_target_attributes is disabled, the build gets fine.

ocheron commented 4 years ago

I'm not surprised, I saw this too. GCC 4.8 has a version of the header files requiring global target attributes. GCC 4.9 is fine. How is it serious, are there many distributions still with 4.8? That's precisely why flag use_target_attributes exists.

kazu-yamamoto commented 4 years ago

CentOS 7 provides GCC 4.8 while CentOS 8 uses 8.3. I will try this on CentOS 8. (The reason why I had a CentOS 8 instance is GSO (Generic Segmentation Offload) which is considered as a key to improve the performance of QUIC.)

kazu-yamamoto commented 4 years ago

OK. cabal install cryptonite -f support_pclmuldq works well on CentOS 8. Let's close this.

ocheron commented 4 years ago

Thanks for the details about CentOS. I added a note in the README file.