valeriansaliou / node-hashtable

:fire: Native hashtable interface for when V8 objects can't take the heat.
https://www.npmjs.com/package/hashtable-patch-valeriansaliou
MIT License
5 stars 4 forks source link

node-gyp build fails in ubuntu #2

Closed elhoyos closed 7 years ago

elhoyos commented 7 years ago

When running $ npm install --production on a project using https://github.com/valeriansaliou/node-fast-ratelimit I get this error:

> hashtable-patch-valeriansaliou@2.1.5 install /home/ubuntu/my_project/node_modules/hashtable-patch-valeriansaliou
> node-gyp configure build

make: Entering directory `/home/ubuntu/my_project/node_modules/hashtable-patch-valeriansaliou/build'
  CXX(target) Release/obj.target/native/src/hashtable.o
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>)
                                                                ^
make: *** [Release/obj.target/native/src/hashtable.o] Error 1
make: Leaving directory `/home/ubuntu/my_project/node_modules/hashtable-patch-valeriansaliou/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/ubuntu/.nvm/versions/node/v6.9.5/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 3.13.0-48-generic
gyp ERR! command "/home/ubuntu/.nvm/versions/node/v6.9.5/bin/node" "/home/ubuntu/.nvm/versions/node/v6.9.5/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/ubuntu/my_project/node_modules/hashtable-patch-valeriansaliou
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN my-server@0.1.2 No license field.
npm ERR! Linux 3.13.0-48-generic
npm ERR! argv "/home/ubuntu/.nvm/versions/node/v6.9.5/bin/node" "/home/ubuntu/.nvm/versions/node/v6.9.5/bin/npm" "install" "--production"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

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 'node-gyp configure build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hashtable-patch-valeriansaliou package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp configure build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs hashtable-patch-valeriansaliou
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls hashtable-patch-valeriansaliou
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ubuntu/my_project/npm-debug.log

I thought was suffering from this same problem given the error line and message points there, but after running the test case there the compilation runs ok.

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)

$ gcc -c test.c # compiles ok

I use OS X in my dev environment and the compilation runs ok.

Any advise?

valeriansaliou commented 7 years ago

From what I see you're running an older version of the C++ compiler that doesn't support the code syntax (it's a recent syntax).

My Debian GCC (production):

[root@runner-1 ~]# gcc --version
gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 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.

My Mac GCC (development):

⋊> ~ gcc --version                                                                                                             17:27:58
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin17.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
valeriansaliou commented 7 years ago

(see my latest edit, added more things)

elhoyos commented 7 years ago

It worked! I upgraded to 4.9.4. Thank you so much.