valeriansaliou / node-fast-ratelimit

:umbrella: Fast and efficient in-memory rate-limit for Node, used to alleviate most common DOS attacks.
https://www.npmjs.com/package/fast-ratelimit
MIT License
108 stars 19 forks source link

Compile error on Travis CI: missing binary operator before token "(" #13

Closed palmerabollo closed 3 years ago

palmerabollo commented 5 years ago

This is the error you get if you try to npm install fast-ratelimit on Travis

npm ci stdout:

> hashtable-patch-valeriansaliou@2.1.5 install /home/travis/build/xyz/node_modules/hashtable-patch-valeriansaliou
> node-gyp configure build
make: Entering directory `/home/travis/build/xyz/node_modules/hashtable-patch-valeriansaliou/build'
  CXX(target) Release/obj.target/native/src/hashtable.o
make: Leaving directory `/home/travis/build/xyz/node_modules/hashtable-patch-valeriansaliou/build'
lerna ERR! npm ci stderr:
In file included from ../src/hashtable.cpp:1:0:
../src/hashtable.h:6:64: error: missing binary operator before token "("
 #if defined __APPLE__ && defined __has_include && __has_include(<tr1/unordered_map>)
                                                                ^
In file included from ../src/hashtable.h:15:0,
                 from ../src/hashtable.cpp:1:
../src/v8_value_hasher.h:7:64: error: missing binary operator before token "("
 #if defined __APPLE__ && defined __has_include && __has_include(<tr1/unordered_map>)
                                                                ^
In file included from ../src/hashtable.h:15:0,
                 from ../src/hashtable.cpp:1:
../src/v8_value_hasher.h: In member function ‘bool v8_value_equal_to::operator()(CopyablePersistent*, CopyablePersistent*) const’:
../src/v8_value_hasher.h:43:24: warning: ‘bool v8::Value::Equals(v8::Local<v8::Value>) const’ is deprecated (declared at /home/travis/.node-gyp/10.15.3/include/node/v8.h:2481): Use maybe version [-Wdeprecated-declarations]
         if (a->Equals(b)) {          /* same as JS == */
                        ^
../src/hashtable.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HashTable::Constructor(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/hashtable.cpp:50:43: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated (declared at /home/travis/.node-gyp/10.15.3/include/node/v8.h:2478): Use maybe version [-Wdeprecated-declarations]
         int buckets = info[0]->Int32Value();
                                           ^
../src/hashtable.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HashTable::Rehash(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/hashtable.cpp:231:42: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated (declared at /home/travis/.node-gyp/10.15.3/include/node/v8.h:2478): Use maybe version [-Wdeprecated-declarations]
     size_t buckets = info[0]->Int32Value();
                                          ^
../src/hashtable.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HashTable::Reserve(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/hashtable.cpp:249:43: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated (declared at /home/travis/.node-gyp/10.15.3/include/node/v8.h:2478): Use maybe version [-Wdeprecated-declarations]
     size_t elements = info[0]->Int32Value();
                                           ^
../src/hashtable.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HashTable::MaxLoadFactor(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/hashtable.cpp:266:39: warning: ‘double v8::Value::NumberValue() const’ is deprecated (declared at /home/travis/.node-gyp/10.15.3/include/node/v8.h:2475): Use maybe version [-Wdeprecated-declarations]
         factor = info[0]->NumberValue();
                                       ^
../src/hashtable.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HashTable::ForEach(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/hashtable.cpp:289:33: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/travis/.node-gyp/10.15.3/include/node/v8.h:10046): Use maybe version [-Wdeprecated-declarations]
         ctx = info[1]->ToObject();
                                 ^
make: *** [Release/obj.target/native/src/hashtable.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/travis/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.4.0-101-generic
gyp ERR! command "/home/travis/.nvm/versions/node/v10.15.3/bin/node" "/home/travis/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/travis/build/xyz/node_modules/hashtable-patch-valeriansaliou
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hashtable-patch-valeriansaliou@2.1.5 install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the hashtable-patch-valeriansaliou@2.1.5 install script.
valeriansaliou commented 5 years ago

Hello. What’s your compiler version?

--

Valerian Saliou CTO at Crisp

On 22 Apr 2019, at 7:47 AM, Guido García notifications@github.com wrote:

This is the error you get if you try to npm install fast-ratelimit on Travis

npm ci stdout:

hashtable-patch-valeriansaliou@2.1.5 install /home/travis/build/xyz/node_modules/hashtable-patch-valeriansaliou node-gyp configure build make: Entering directory /home/travis/build/xyz/node_modules/hashtable-patch-valeriansaliou/build' CXX(target) Release/obj.target/native/src/hashtable.o make: Leaving directory/home/travis/build/xyz/node_modules/hashtable-patch-valeriansaliou/build' lerna ERR! npm ci stderr: In file included from ../src/hashtable.cpp:1:0: ../src/hashtable.h:6:64: error: missing binary operator before token "("

if defined APPLE && defined __has_include && __has_include(<tr1/unordered_map>)

^ In file included from ../src/hashtable.h:15:0, from ../src/hashtable.cpp:1: ../src/v8_value_hasher.h:7:64: error: missing binary operator before token "("

if defined APPLE && defined __has_include && __has_include(<tr1/unordered_map>)

^ In file included from ../src/hashtable.h:15:0, from ../src/hashtable.cpp:1: ../src/v8_value_hasher.h: In member function ‘bool v8_value_equal_to::operator()(CopyablePersistent, CopyablePersistent) const’: ../src/v8_value_hasher.h:43:24: warning: ‘bool v8::Value::Equals(v8::Local) const’ is deprecated (declared at /home/travis/.node-gyp/10.15.3/include/node/v8.h:2481): Use maybe version [-Wdeprecated-declarations] if (a->Equals(b)) { / same as JS == / ^ ../src/hashtable.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HashTable::Constructor(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/hashtable.cpp:50:43: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated (declared at /home/travis/.node-gyp/10.15.3/include/node/v8.h:2478): Use maybe version [-Wdeprecated-declarations] int buckets = info[0]->Int32Value(); ^ ../src/hashtable.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HashTable::Rehash(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/hashtable.cpp:231:42: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated (declared at /home/travis/.node-gyp/10.15.3/include/node/v8.h:2478): Use maybe version [-Wdeprecated-declarations] size_t buckets = info[0]->Int32Value(); ^ ../src/hashtable.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HashTable::Reserve(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/hashtable.cpp:249:43: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated (declared at /home/travis/.node-gyp/10.15.3/include/node/v8.h:2478): Use maybe version [-Wdeprecated-declarations] size_t elements = info[0]->Int32Value(); ^ ../src/hashtable.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HashTable::MaxLoadFactor(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/hashtable.cpp:266:39: warning: ‘double v8::Value::NumberValue() const’ is deprecated (declared at /home/travis/.node-gyp/10.15.3/include/node/v8.h:2475): Use maybe version [-Wdeprecated-declarations] factor = info[0]->NumberValue(); ^ ../src/hashtable.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HashTable::ForEach(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/hashtable.cpp:289:33: warning: ‘v8::Local v8::Value::ToObject() const’ is deprecated (declared at /home/travis/.node-gyp/10.15.3/include/node/v8.h:10046): Use maybe version [-Wdeprecated-declarations] ctx = info[1]->ToObject(); ^ make: *** [Release/obj.target/native/src/hashtable.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/travis/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:189:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) gyp ERR! System Linux 4.4.0-101-generic gyp ERR! command "/home/travis/.nvm/versions/node/v10.15.3/bin/node" "/home/travis/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build" gyp ERR! cwd /home/travis/build/xyz/node_modules/hashtable-patch-valeriansaliou gyp ERR! node -v v10.15.3 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! hashtable-patch-valeriansaliou@2.1.5 install: node-gyp configure build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the hashtable-patch-valeriansaliou@2.1.5 install script. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

palmerabollo commented 5 years ago

gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4

Running on Ubuntu 14.04.5 LTS (kernel version: 4.4.0-101-generic)

valeriansaliou commented 3 years ago

Hello there! I've fixed that in v3.0.0, using the JS-native Map object, which has as well be measured in my tests to be faster anyway. This new version does not compile any dependencies anymore, fixing this issue.