barrysteyn / node-scrypt

Scrypt for Node
369 stars 88 forks source link

Error installing at `node-gyp rebuild` #179

Closed adklempner closed 6 years ago

adklempner commented 6 years ago

I've received this same error both trying to build this package from source and installing it as an npm dependency I'm running macOS High Sierra 10.13.6

> node-gyp rebuild

  SOLINK_MODULE(target) Release/copied_files.node
  CC(target) Release/obj.target/scrypt_wrapper/src/util/memlimit.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/keyderivation.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/pickparams.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/hash.o
  LIBTOOL-STATIC Release/scrypt_wrapper.a
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/crypto/crypto_scrypt.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/crypto/crypto_scrypt_smix.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/util/warnp.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/alg/sha256.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/util/insecure_memzero.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/scryptenc/scryptenc_cpuperf.o
../scrypt/scrypt-1.2.0/lib/scryptenc/scryptenc_cpuperf.c:48:8: error: unknown type name 'clock_t'
static clock_t clocktouse;
       ^
../scrypt/scrypt-1.2.0/lib/scryptenc/scryptenc_cpuperf.c:71:6: warning: implicit declaration of function 'clock_getres' is invalid in C99 [-Wimplicit-function-declaration]
        if (clock_getres(CLOCK_REALTIME, &res) == 0)
            ^
../scrypt/scrypt-1.2.0/lib/scryptenc/scryptenc_cpuperf.c:71:19: error: use of undeclared identifier 'CLOCK_REALTIME'
        if (clock_getres(CLOCK_REALTIME, &res) == 0)
                         ^
../scrypt/scrypt-1.2.0/lib/scryptenc/scryptenc_cpuperf.c:72:16: error: use of undeclared identifier 'CLOCK_REALTIME'
                clocktouse = CLOCK_REALTIME;
                             ^
../scrypt/scrypt-1.2.0/lib/scryptenc/scryptenc_cpuperf.c:86:6: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
        if (clock_gettime(clocktouse, ts))
            ^
2 warnings and 3 errors generated.
make: *** [Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/scryptenc/scryptenc_cpuperf.o] Error 1
adklempner commented 6 years ago

The issue was with my system. Following the instructions from this StackOverflow answer fixed my issue.