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

Installing "pg" with Node v0.11.4 fails with Buffer related errors (because of ref) #411

Closed
moll opened this issue Jul 28, 2013 · 14 comments
Assignees

Comments

@moll
Copy link

moll commented Jul 28, 2013

After npm install pg I'm greeted with:

../src/binding.cc:121:3: error: unexpected namespace name 'Buffer': expected
      expression
  Buffer *buf = Buffer::New(ptr, buf_size, unref_null_cb, user_data);
  ^
../src/binding.cc:121:11: error: use of undeclared identifier 'buf'
  Buffer *buf = Buffer::New(ptr, buf_size, unref_null_cb, user_data);
          ^
../src/binding.cc:122:45: error: 'New' is a private member of
      'v8::Persistent<v8::Object>'
  null_pointer_buffer = Persistent<Object>::New(buf->handle_);
                                            ^

...

gyp ERR! cwd /Users/user/foo/node_modules/pg/node_modules/ref
gyp ERR! node -v v0.11.4
gyp ERR! node-gyp -v v0.10.6

And on that bombshell, have a great Sunday!

@moll
Copy link
Author

moll commented Jul 28, 2013

Oh, and pg itself was at v2.2.0.

@ghost ghost assigned booo Jul 29, 2013
@booo
Copy link
Contributor

booo commented Jul 29, 2013

My build log with errors:

Now using node v0.11.4
/home/borgers/.nvm/v0.11.4/bin/npm
★ projects  cd /tmp 
★ /tmp  npm install pg
npm http GET https://registry.npmjs.org/pg
npm http 200 https://registry.npmjs.org/pg
npm http GET https://registry.npmjs.org/pg/-/pg-2.2.0.tgz
npm http 200 https://registry.npmjs.org/pg/-/pg-2.2.0.tgz
npm http GET https://registry.npmjs.org/buffer-writer/1.0.0
npm http GET https://registry.npmjs.org/generic-pool/2.0.3
npm http GET https://registry.npmjs.org/ref/0.1.3
npm http 200 https://registry.npmjs.org/buffer-writer/1.0.0
npm http GET https://registry.npmjs.org/buffer-writer/-/buffer-writer-1.0.0.tgz
npm http 200 https://registry.npmjs.org/generic-pool/2.0.3
npm http GET https://registry.npmjs.org/generic-pool/-/generic-pool-2.0.3.tgz
npm http 200 https://registry.npmjs.org/ref/0.1.3
npm http GET https://registry.npmjs.org/ref/-/ref-0.1.3.tgz
npm http 200 https://registry.npmjs.org/buffer-writer/-/buffer-writer-1.0.0.tgz
npm http 200 https://registry.npmjs.org/generic-pool/-/generic-pool-2.0.3.tgz
npm http 200 https://registry.npmjs.org/ref/-/ref-0.1.3.tgz
npm http GET https://registry.npmjs.org/cloned/0.0.1
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/bindings
npm http 200 https://registry.npmjs.org/cloned/0.0.1
npm http GET https://registry.npmjs.org/cloned/-/cloned-0.0.1.tgz
npm http 304 https://registry.npmjs.org/debug
npm http 200 https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/bindings/-/bindings-1.1.1.tgz
npm http 200 https://registry.npmjs.org/cloned/-/cloned-0.0.1.tgz
npm http 200 https://registry.npmjs.org/bindings/-/bindings-1.1.1.tgz

> ref@0.1.3 install /tmp/node_modules/pg/node_modules/ref
> node-gyp rebuild

gyp http GET http://nodejs.org/dist/v0.11.4/node-v0.11.4.tar.gz
gyp http 200 http://nodejs.org/dist/v0.11.4/node-v0.11.4.tar.gz
npm http 200 https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/rmdir
npm http 200 https://registry.npmjs.org/rmdir
npm http GET https://registry.npmjs.org/rmdir/-/rmdir-1.0.0.tgz
npm http 200 https://registry.npmjs.org/rmdir/-/rmdir-1.0.0.tgz
make: Entering directory `/tmp/node_modules/pg/node_modules/ref/build'
  CXX(target) Release/obj.target/binding/src/binding.o
../src/binding.cc: In function ‘v8::Persistent<v8::Object> {anonymous}::WrapNullPointer()’:
../src/binding.cc:121:10: error: expected primary-expression before ‘*’ token
../src/binding.cc:121:11: error: ‘buf’ was not declared in this scope
/home/borgers/.node-gyp/0.11.4/deps/v8/include/v8.h:751:3: error: ‘v8::Persistent<T>::Persistent(const v8::Persistent<T>&) [with T = v8::Object, v8::Persistent<T> = v8::Persistent<v8::Object>]’ is private
../src/binding.cc:123:10: error: within this context
../src/binding.cc: In function ‘v8::Handle<v8::Value> {anonymous}::ReadObject(const v8::Arguments&)’:
../src/binding.cc:151:64: error: conversion from ‘v8::Persistent<v8::Value>’ to non-scalar type ‘v8::Handle<v8::Value>’ requested
../src/binding.cc: In function ‘v8::Handle<v8::Value> {anonymous}::WriteObject(const v8::Arguments&)’:
../src/binding.cc:188:57: error: no matching function for call to ‘v8::Persistent<v8::Value>::New(v8::Local<v8::Value>)’
../src/binding.cc:188:57: note: candidate is:
/home/borgers/.node-gyp/0.11.4/deps/v8/include/v8.h:5585:4: note: static T* v8::Persistent<T>::New(v8::Isolate*, T*) [with T = v8::Value]
/home/borgers/.node-gyp/0.11.4/deps/v8/include/v8.h:5585:4: note:   candidate expects 2 arguments, 1 provided
../src/binding.cc:189:37: error: no matching function for call to ‘v8::Persistent<v8::Value>::MakeWeak(NULL, void (&)(v8::Persistent<v8::Value>, void*))’
../src/binding.cc:189:37: note: candidates are:
/home/borgers/.node-gyp/0.11.4/deps/v8/include/v8.h:635:3: note: template<class S, class P> void v8::Persistent::MakeWeak(P*, typename v8::WeakReferenceCallbacks<S, P>::Revivable) [with S = S, P = P, T = v8::Value, typename v8::WeakReferenceCallbacks<S, P>::Revivable = v8::WeakReferenceCallbacks<T, P>::Revivable]
/home/borgers/.node-gyp/0.11.4/deps/v8/include/v8.h:5646:6: note: template<class P> void v8::Persistent::MakeWeak(P*, typename v8::WeakReferenceCallbacks<T, P>::Revivable) [with P = P, T = v8::Value, typename v8::WeakReferenceCallbacks<T, P>::Revivable = <type error>]
/home/borgers/.node-gyp/0.11.4/deps/v8/include/v8.h:645:3: note: template<class S, class P> void v8::Persistent::MakeWeak(v8::Isolate*, P*, typename v8::WeakReferenceCallbacks<S, P>::Revivable) [with S = S, P = P, T = v8::Value, typename v8::WeakReferenceCallbacks<S, P>::Revivable = v8::WeakReferenceCallbacks<T, P>::Revivable]
/home/borgers/.node-gyp/0.11.4/deps/v8/include/v8.h:651:3: note: template<class P> void v8::Persistent::MakeWeak(v8::Isolate*, P*, typename v8::WeakReferenceCallbacks<T, P>::Revivable) [with P = P, T = v8::Value, typename v8::WeakReferenceCallbacks<T, P>::Revivable = <type error>]
/home/borgers/.node-gyp/0.11.4/deps/v8/include/v8.h:753:3: error: ‘v8::Persistent<T>& v8::Persistent<T>::operator=(const v8::Persistent<T>&) [with T = v8::Value, v8::Persistent<T> = v8::Persistent<v8::Value>]’ is private
../src/binding.cc:190:48: error: within this context
../src/binding.cc: In function ‘v8::Handle<v8::Value> {anonymous}::ReadPointer(const v8::Arguments&)’:
../src/binding.cc:232:10: error: expected primary-expression before ‘*’ token
../src/binding.cc:232:11: error: ‘rtn_buf’ was not declared in this scope
../src/binding.cc: In function ‘v8::Handle<v8::Value> {anonymous}::ReinterpretBuffer(const v8::Arguments&)’:
../src/binding.cc:493:10: error: expected primary-expression before ‘*’ token
../src/binding.cc:493:11: error: ‘rtn’ was not declared in this scope
../src/binding.cc: In function ‘v8::Handle<v8::Value> {anonymous}::ReinterpretBufferUntilZeros(const v8::Arguments&)’:
../src/binding.cc:543:10: error: expected primary-expression before ‘*’ token
../src/binding.cc:543:11: error: ‘rtn’ was not declared in this scope
../src/binding.cc: In function ‘void init(v8::Handle<v8::Object>)’:
../src/binding.cc:640:112: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, v8::Persistent<v8::Object>, v8::PropertyAttribute)’
../src/binding.cc:640:112: note: candidates are:
/home/borgers/.node-gyp/0.11.4/deps/v8/include/v8.h:2036:8: note: bool v8::Object::Set(v8::Handle<v8::Value>, v8::Handle<v8::Value>, v8::PropertyAttribute)
/home/borgers/.node-gyp/0.11.4/deps/v8/include/v8.h:2036:8: note:   no known conversion for argument 2 from ‘v8::Persistent<v8::Object>’ to ‘v8::Handle<v8::Value>’
/home/borgers/.node-gyp/0.11.4/deps/v8/include/v8.h:2040:8: note: bool v8::Object::Set(uint32_t, v8::Handle<v8::Value>)
/home/borgers/.node-gyp/0.11.4/deps/v8/include/v8.h:2040:8: note:   candidate expects 2 arguments, 3 provided
../src/binding.cc:641:45: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [8], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:641:45: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
../src/binding.cc:642:43: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [7], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:642:43: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
../src/binding.cc:643:51: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [11], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:643:51: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
../src/binding.cc:644:53: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [12], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:644:53: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
../src/binding.cc:645:53: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [12], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:645:53: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
../src/binding.cc:646:55: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [13], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:646:55: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
../src/binding.cc:647:49: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [10], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:647:49: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
../src/binding.cc:648:51: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [11], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:648:51: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
../src/binding.cc:649:51: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [11], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:649:51: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
../src/binding.cc:650:53: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [12], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:650:53: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
../src/binding.cc:651:53: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [12], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:651:53: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
../src/binding.cc:652:59: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [12], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:652:59: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
../src/binding.cc:653:79: error: no matching function for call to ‘NODE_SET_METHOD(v8::Handle<v8::Object>&, const char [22], v8::Handle<v8::Value> (&)(const v8::Arguments&))’
../src/binding.cc:653:79: note: candidate is:
/home/borgers/.node-gyp/0.11.4/src/node.h:140:13: note: template<class TypeName> void node::NODE_SET_METHOD(TypeName&, const char*, v8::FunctionCallback)
make: *** [Release/obj.target/binding/src/binding.o] Error 1
make: Leaving directory `/tmp/node_modules/pg/node_modules/ref/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/borgers/.nvm/v0.11.4/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:103:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.2.0-40-generic
gyp ERR! command "node" "/home/borgers/.nvm/v0.11.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/node_modules/pg/node_modules/ref
gyp ERR! node -v v0.11.4
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok 
npm ERR! weird error 1
npm ERR! not ok code 0

@brianc
Copy link
Owner

brianc commented Jul 29, 2013

I'm tempted to remove the dependency on ref all together. It's used in only one very particular case for a small percentage of people who use the binary query mode. It would be easy enough to add the Int64 binary parser in a 3rd party module so we could get rid of all this headache.

@moll
Copy link
Author

moll commented Jul 29, 2013

I've got your back! Less of "pg" is better than not-working "pg" any time!

@brianc
Copy link
Owner

brianc commented Jul 30, 2013

Newest version drops requirement for the ref module. Should install fine now. 👍

@moll
Copy link
Author

moll commented Jul 30, 2013

Good news! I can confirm ref no longer throws any errors!

However, pg now does. :P

Top of the errors look as follows:

../src/binding.cc:45:51: warning: 'New' is deprecated
      [-Wdeprecated-declarations]
    Local<FunctionTemplate> t = FunctionTemplate::New(New);
                                                  ^
/Users/user/.node-gyp/0.11.4/deps/v8/include/v8.h:3263:48: note: 'New' declared
      here
  V8_DEPRECATED(static Local<FunctionTemplate> New(
                                               ^
/Users/user/.node-gyp/0.11.4/deps/v8/include/v8.h:88:35: note: expanded from
      macro 'V8_DEPRECATED'
#define V8_DEPRECATED(declarator) declarator __attribute__ ((deprecated))
                                  ^
../src/binding.cc:50:19: error: use of undeclared identifier 'NODE_PSYMBOL'
    emit_symbol = NODE_PSYMBOL("emit");
                  ^
../src/binding.cc:51:23: error: use of undeclared identifier 'NODE_PSYMBOL'
    severity_symbol = NODE_PSYMBOL("severity");
                      ^
../src/binding.cc:52:19: error: use of undeclared identifier 'NODE_PSYMBOL'
    code_symbol = NODE_PSYMBOL("code");

This is with the stock Node v0.11.4 from Mac's homebrew.

gyp ERR! cwd /Users/user/foo/node_modules/pg
gyp ERR! node -v v0.11.4
gyp ERR! node-gyp -v v0.10.6

@brianc
Copy link
Owner

brianc commented Jul 31, 2013

I really appreciate your issue report. Extremely thorough and easy to tell what's wrong. It shouldn't be a hard fix, I just need to find what node's using now instead of the NODE_PSYMBOL macro. I had to travel for work last week so I'm responding a bit slower than normal.

@brianc
Copy link
Owner

brianc commented Jul 31, 2013

K I got some info from #libuv freenode. I can fix this pretty quickly.

@moll
Copy link
Author

moll commented Jul 31, 2013

Thank you for thanking me and thank you for p-gee!

@booo
Copy link
Contributor

booo commented Aug 27, 2013

@brianc If you can find the time to share the information about the solution I can maybe do the implementation.

@brianc
Copy link
Owner

brianc commented Aug 28, 2013

@booo last time I checked (two weeks ago) they are still modifying the C++ API so I wouldn't sweat it until it gets closer to v0.12.0 release. At that time I'll let you know - I think someone mentioned releasing a migration guide when it gets closer. Both the V8 api and node C++ api have changed.

@brianc
Copy link
Owner

brianc commented Aug 29, 2013

You can use this in the mean time: https://github.com/brianc/node-postgres-pure

@brianc
Copy link
Owner

brianc commented Nov 20, 2014

I think I got this fixed thanks to the lovely NaN module & some hard work refactoring everything. If you give the new npm install pg pg-native a try I think everything should work correctly for you now!

@brianc brianc closed this as completed Nov 20, 2014
@moll
Copy link
Author

moll commented Nov 23, 2014

Gotcha. Thanks! Will give it a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants