dannycoates / scrypt-hash

node bindings for crypto_scrypt
8 stars 7 forks source link

Compilation failed on Debian #4

Open sanpii opened 10 years ago

sanpii commented 10 years ago

The compilation failed on debian stable i386:

$ node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@0.12.2
gyp info using node@0.10.26 | linux | ia32
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: entrant dans le répertoire « /home/sanpi/scrypt-hash/build »
  CC(target) Release/obj.target/scrypt/crypto_scrypt-sse.o
In file included from ../crypto_scrypt-sse.c:33:0:
/usr/lib/gcc/i486-linux-gnu/4.7/include/emmintrin.h:32:3: error: #error "SSE2 instruction set not enabled"
../crypto_scrypt-sse.c:45:23: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c:46:29: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c:46:40: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c:46:51: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c: In function ‘blkcpy’:
../crypto_scrypt-sse.c:84:2: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c:85:2: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c: In function ‘blkxor’:
../crypto_scrypt-sse.c:96:2: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c:97:2: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c:102:3: warning: implicit declaration of function ‘_mm_xor_si128’ [-Wimplicit-function-declaration]
../crypto_scrypt-sse.c: At top level:
../crypto_scrypt-sse.c:110:11: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c:174:17: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c:174:32: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c:174:48: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c: In function ‘smix’:
../crypto_scrypt-sse.c:224:2: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c:225:2: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c:226:2: error: unknown type name ‘__m128i’
../crypto_scrypt-sse.c:242:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
../crypto_scrypt-sse.c:245:3: warning: implicit declaration of function ‘blockmix_salsa8’ [-Wimplicit-function-declaration]
../crypto_scrypt-sse.c:248:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
../crypto_scrypt-sse.c:261:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
../crypto_scrypt-sse.c:268:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
make: *** [Release/obj.target/scrypt/crypto_scrypt-sse.o] Erreur 1
make: quittant le répertoire « /home/sanpi/scrypt-hash/build »
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.2.0-4-686-pae
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "build"
gyp ERR! cwd /home/sanpi/scrypt-hash
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 

Of course, my CPU has sse2 flag:

$ grep sse2 /proc/cpuinfo 
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer xsave rdrand lahf_lm abm arat xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase erms
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer xsave rdrand lahf_lm abm arat xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase erms
$ uname -a
Linux cuddles 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686 GNU/Linux
$ cat /etc/issue
Debian GNU/Linux 7 \n \l
$ node -v
v0.10.26
Vish22 commented 10 years ago

Hi, same issue on a Wheezy related with SSE2 instructions. Any tips?

xppppp commented 10 years ago

export CC="gcc -msse2"; npm install scrypt-hash worked for me.

vladikoff commented 8 years ago

Another way to resolve this on Ubuntu 12 and node 4:

Now check gcc again, it should be:

root@c062b0b57054:/# gcc --version
gcc (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Now install scrypt-hash again:

root@c062b0b57054:/# npm i scrypt-hash@1.1.13
\
> scrypt-hash@1.1.13 install /node_modules/scrypt-hash
> node-gyp rebuild

make: Entering directory `/node_modules/scrypt-hash/build'
  CC(target) Release/obj.target/scrypt/crypto_scrypt-sse.o
  CXX(target) Release/obj.target/scrypt/node_scrypt.o
  SOLINK_MODULE(target) Release/obj.target/scrypt.node
  COPY Release/scrypt.node
make: Leaving directory `/node_modules/scrypt-hash/build'
scrypt-hash@1.1.13 node_modules/scrypt-hash
├── bindings@1.2.1
└── nan@2.0.9
root@c062b0b57054:/# 

Ref http://ubuntuhandbook.org/index.php/2013/08/install-gcc-4-8-via-ppa-in-ubuntu-12-04-13-04/

wzeth commented 8 years ago

$ sudo apt install build-essentials

Fixed the issue for me. I did not have make installed.

shapirus commented 6 years ago

Build fails on Debian Stretch i386:

../crypto_scrypt-sse.c: In function ‘blkxor’: ../crypto_scrypt-sse.c:102:8: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi] D[i] = _mm_xor_si128(D[i], S[i]);


In file included from ../crypto_scrypt-sse.c:33:0:
/usr/lib/gcc/i686-linux-gnu/6/include/emmintrin.h:1286:1: error: inlining failed in call to always_inline ‘_mm_xor_si128’: target specific option mismatch
 _mm_xor_si128 (__m128i __A, __m128i __B)
 ^~~~~~~~~~~~~
../crypto_scrypt-sse.c:102:10: note: called from here
   D[i] = _mm_xor_si128(D[i], S[i]);
          ^~~~~~~~~~~~~~~~~~~~~~~~~
scrypt.target.mk:103: recipe for target 'Release/obj.target/scrypt/crypto_scrypt-sse.o' failed
make: *** [Release/obj.target/scrypt/crypto_scrypt-sse.o] Error 1
make: Leaving directory '/home/mozsync/mozsync/fxa-auth-server/node_modules/scrypt-hash/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)

builds successfully with export CFLAGS="-msse4.1"