Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem rebuilding with the bundled node-gyp in v2.0.0 #1619

Closed
laukaichung opened this issue May 5, 2015 · 8 comments
Closed

Problem rebuilding with the bundled node-gyp in v2.0.0 #1619

laukaichung opened this issue May 5, 2015 · 8 comments
Labels
c++ Issues and PRs that require attention from people who are familiar with C++.

Comments

@laukaichung
Copy link

Hi, I just downloaded v2.0.0 to test on my server. In v1.8.1, I could solve the error Failed to load c++ bson extension, using pure JS version from mongoose 3.8 using the bundled node-gyp from io.js:

1.cd /iojs-v1.8.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp
2.npm link -f
3.cd /app/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/
4.node-gyp rebuild

But I can't rebuild js-bson in v2.0.0. It gives me a lot of error like wrong number of arguments specified for 'deprecated' attribute:

gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.3
gyp info using node@2.0.0 | linux | x64
gyp info spawn python
gyp info spawn args [ '/2/iojs-v2.0.0-linux-x64/lib/node_modules/npm/node_module                                             s/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/apps/js/node_modules/mongoose/node_modules/mon                                             godb/node_modules/bson/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/2/iojs-v2.0.0-linux-x64/lib/node_modules/npm/node_module                                             s/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.node-gyp/2.0.0/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/2.0.0',
gyp info spawn args   '-Dmodule_root_dir=/usr/local/apps/js/node_modules/mongoos                                             e/node_modules/mongodb/node_modules/bson',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/usr/local/apps/js/node_modules/mongoose/node_modules/                                             mongodb/node_modules/bson/build'
  CXX(target) Release/obj.target/bson/ext/bson.o
In file included from ../ext/bson.cc:22:
/root/.node-gyp/2.0.0/src/node.h:80: error: wrong number of arguments specified                                              for 'deprecated' attribute
In file included from ../ext/bson.cc:22:
/root/.node-gyp/2.0.0/src/node.h:252: error: wrong number of arguments specified                                              for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node.h:262: error: wrong number of arguments specified                                              for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node.h:278: error: wrong number of arguments specified                                              for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node.h:297: error: wrong number of arguments specified                                              for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node.h:310: error: wrong number of arguments specified                                              for 'deprecated' attribute
In file included from /root/.node-gyp/2.0.0/src/node_buffer.h:5,
                 from ../ext/bson.cc:24:
/root/.node-gyp/2.0.0/src/smalloc.h:29: error: wrong number of arguments specifi                                             ed for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/smalloc.h:60: error: wrong number of arguments specifi                                             ed for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/smalloc.h:67: error: wrong number of arguments specifi                                             ed for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/smalloc.h:75: error: wrong number of arguments specifi                                             ed for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/smalloc.h:84: error: wrong number of arguments specifi                                             ed for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/smalloc.h:99: error: wrong number of arguments specifi                                             ed for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/smalloc.h:108: error: wrong number of arguments specif                                             ied for 'deprecated' attribute
In file included from ../ext/bson.cc:24:
/root/.node-gyp/2.0.0/src/node_buffer.h:26: error: wrong number of arguments spe                                             cified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node_buffer.h:34: error: wrong number of arguments spe                                             cified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node_buffer.h:44: error: wrong number of arguments spe                                             cified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node_buffer.h:54: error: wrong number of arguments spe                                             cified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node_buffer.h:67: error: wrong number of arguments spe                                             cified for 'deprecated' attribute
In file included from ../node_modules/nan/nan_new.h:190,
                 from ../node_modules/nan/nan.h:80,
                 from ../ext/bson.h:17,
                 from ../ext/bson.cc:36:
../node_modules/nan/nan_implementation_12_inl.h: In static member function 'stat                                             ic v8::Local<v8::Signature> NanIntern::Factory<v8::Signature>::New(NanIntern::Fa                                             ctory<v8::Signature>::FTH, int, NanIntern::Factory<v8::Signature>::FTH*)':
../node_modules/nan/nan_implementation_12_inl.h:181: error: no matching function                                              for call to 'v8::Signature::New(v8::Isolate*, NanIntern::Factory<v8::Signature>                                             ::FTH&, int&, NanIntern::Factory<v8::Signature>::FTH*&)'
/root/.node-gyp/2.0.0/deps/v8/include/v8.h:4188: note: candidates are: static v8                                             ::Local<v8::Signature> v8::Signature::New(v8::Isolate*, v8::Handle<v8::FunctionT                                             emplate>)
make: *** [Release/obj.target/bson/ext/bson.o] Error 1
make: Leaving directory `/usr/local/apps/js/node_modules/mongoose/node_modules/m                                             ongodb/node_modules/bson/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/2/iojs-v2.0.0-linux-x64/lib/node_mod                                             ules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:169:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1009                                             :12)
gyp ERR! System Linux 2.6.32-042stab106.6
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/apps/js/node_modules/mongoose/node_modules/mongodb/node_                                             modules/bson
gyp ERR! node -v v2.0.0
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok

I have also tried upgrading mongoose to version 4 but the errors don't go away.

@mscdex mscdex added the c++ Issues and PRs that require attention from people who are familiar with C++. label May 5, 2015
@imyller
Copy link
Member

imyller commented May 5, 2015

This has been fixed in bson-ext 0.1.4 at mongodb-js/bson-ext@3584fb5

@bnoordhuis
Copy link
Member

There seems to be a secondary issue with the NODE_DEPRECATED macro (the 'wrong number of arguments' errors).

When you run env V=1 node-gyp rebuild, the CXX(target) in the output should have been replaced with the actual compiler. Can you post the output of $actual_compiler -v? Thanks!

@imyller
Copy link
Member

imyller commented May 5, 2015

@stonecold123 should report also but I'm unable to duplicate the secondary issue with NODE_DEPRECATED macro. I am getting (proper?) deprecation warnings:

../ext/bson.cc:825:17: warning: 'DecodeBytes' is deprecated: Use DecodeBytes(isolate, ...) [-Wdeprecated-declarations]
                ssize_t len = DecodeBytes(args[0], BINARY);
                              ^
/Users/-/.node-gyp/2.0.0/src/node.h:298:32: note: 'DecodeBytes' has been explicitly marked deprecated here
                inline ssize_t DecodeBytes(
                               ^
/Users/-/.node-gyp/2.0.0/src/node.h:47:42: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                                         ^

Compiler version:

Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix

@bnoordhuis
Copy link
Member

I speculate that @stonecold123 uses a version of g++ <= 4.7 but I'd like him/her to confirm.

@laukaichung
Copy link
Author

Hi imyller and bnoordhuis,
I'll make a test again later and tell you what I get. Here's my g++ version:

[root@user]g++ -v
Using built-in specs.
Target: x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)

@bnoordhuis
Copy link
Member

Thanks. I'll dig up when gcc added the extended deprecated attribute and update src/node.h accordingly.

@laukaichung
Copy link
Author

bnoordhuis

I don't know why but when I ran env V=1 node-gyp rebuild I was getting the same error. I didn't see the output you described (CentOS release 6.6 (Final)):

[root@user bson]# env V=1 node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.3
gyp info using node@2.0.0 | linux | x64
gyp info spawn python
gyp info spawn args [ '/2/iojs-v2.0.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/apps/js/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/2/iojs-v2.0.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.node-gyp/2.0.0/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/2.0.0',
gyp info spawn args   '-Dmodule_root_dir=/usr/local/apps/js/node_modules/mongoose/node_modules/mongodb/node_modules/bson',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/usr/local/apps/js/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
  g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/root/.node-gyp/2.0.0/src -I/root/.node-gyp/2.0.0/deps/uv/include -I/root/.node-gyp/2.0.0/deps/v8/include -I../node_modules/nan  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-rtti -std=gnu++0x -MMD -MF ./Release/.deps/Release/obj.target/bson/ext/bson.o.d.raw  -c -o Release/obj.target/bson/ext/bson.o ../ext/bson.cc
In file included from ../ext/bson.cc:22:
/root/.node-gyp/2.0.0/src/node.h:80: error: wrong number of arguments specified for 'deprecated' attribute
In file included from ../ext/bson.cc:22:
/root/.node-gyp/2.0.0/src/node.h:252: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node.h:262: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node.h:278: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node.h:297: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node.h:310: error: wrong number of arguments specified for 'deprecated' attribute
In file included from /root/.node-gyp/2.0.0/src/node_buffer.h:5,
                 from ../ext/bson.cc:24:
/root/.node-gyp/2.0.0/src/smalloc.h:29: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/smalloc.h:60: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/smalloc.h:67: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/smalloc.h:75: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/smalloc.h:84: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/smalloc.h:99: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/smalloc.h:108: error: wrong number of arguments specified for 'deprecated' attribute
In file included from ../ext/bson.cc:24:
/root/.node-gyp/2.0.0/src/node_buffer.h:26: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node_buffer.h:34: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node_buffer.h:44: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node_buffer.h:54: error: wrong number of arguments specified for 'deprecated' attribute
/root/.node-gyp/2.0.0/src/node_buffer.h:67: error: wrong number of arguments specified for 'deprecated' attribute
In file included from ../node_modules/nan/nan_new.h:190,
                 from ../node_modules/nan/nan.h:80,
                 from ../ext/bson.h:17,
                 from ../ext/bson.cc:36:
../node_modules/nan/nan_implementation_12_inl.h: In static member function 'static v8::Local<v8::Signature> NanIntern::Factory<v8::Signature>::New(NanIntern::Factory<v8::Signature>::FTH, int, NanIntern::Factory<v8::Signature>::FTH*)':
../node_modules/nan/nan_implementation_12_inl.h:181: error: no matching function for call to 'v8::Signature::New(v8::Isolate*, NanIntern::Factory<v8::Signature>::FTH&, int&, NanIntern::Factory<v8::Signature>::FTH*&)'
/root/.node-gyp/2.0.0/deps/v8/include/v8.h:4188: note: candidates are: static v8::Local<v8::Signature> v8::Signature::New(v8::Isolate*, v8::Handle<v8::FunctionTemplate>)
make: *** [Release/obj.target/bson/ext/bson.o] Error 1
make: Leaving directory `/usr/local/apps/js/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/2/iojs-v2.0.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:169:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1009:12)
gyp ERR! System Linux 2.6.32-042stab106.6
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/apps/js/node_modules/mongoose/node_modules/mongodb/node_modules/bson
gyp ERR! node -v v2.0.0
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue May 5, 2015
The `__attribute__((deprecated("warning")))` macro didn't exist until
gcc 4.5 and clang 2.9.

While io.js does not build with compilers that old, add-ons do.  Let's
make src/node.h compatible with such compilers, it's a public header.

Refs: nodejs#1619
bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue May 5, 2015
The `__attribute__((deprecated("warning")))` macro didn't exist until
gcc 4.5 and clang 2.9.

While io.js does not build with compilers that old, add-ons do.  Let's
make src/node.h compatible with such compilers, it's a public header.

PR-URL: nodejs#1626
Refs: nodejs#1619
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
@Fishrock123
Copy link
Contributor

Should be fixed in b712af7 -- re-open if it isn't.

Fishrock123 pushed a commit to Fishrock123/node that referenced this issue May 19, 2015
The `__attribute__((deprecated("warning")))` macro didn't exist until
gcc 4.5 and clang 2.9.

While io.js does not build with compilers that old, add-ons do.  Let's
make src/node.h compatible with such compilers, it's a public header.

PR-URL: nodejs#1626
Refs: nodejs#1619
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++.
Projects
None yet
Development

No branches or pull requests

5 participants