brianc / node-libpq

Simple, low level native bindings to PostgreSQL's libpq from node.js
111 stars 41 forks source link

Error installing on Arch Linux & Node 12.2.0 #69

Open btakita opened 5 years ago

btakita commented 5 years ago
% npm i -g libpq

> libpq@1.8.8 install /home/brian/.nvm/versions/node/v12.2.0/lib/node_modules/libpq
> node-gyp rebuild

make: Entering directory '/home/brian/.nvm/versions/node/v12.2.0/lib/node_modules/libpq/build'
  CXX(target) Release/obj.target/addon/src/connection.o
In file included from ../src/addon.h:4,
                 from ../src/connection.cc:1:
../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../node_modules/nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
../src/connection.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Connection::Fname(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/connection.cc:204:52: error: no matching function for call to ‘v8::Value::Int32Value()’
   char* colName = PQfname(res, info[0]->Int32Value());
                                                    ^
In file included from /home/brian/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:53,
                 from ../src/addon.h:4,
                 from ../src/connection.cc:1:
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2569:40: note: candidate: ‘v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const’
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2569:40: note:   candidate expects 1 argument, 0 provided
../src/connection.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Connection::Ftype(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/connection.cc:219:50: error: no matching function for call to ‘v8::Value::Int32Value()’
   int colName = PQftype(res, info[0]->Int32Value());
                                                  ^
In file included from /home/brian/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:53,
                 from ../src/addon.h:4,
                 from ../src/connection.cc:1:
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2569:40: note: candidate: ‘v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const’
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2569:40: note:   candidate expects 1 argument, 0 provided
../src/connection.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Connection::Getvalue(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/connection.cc:230:39: error: no matching function for call to ‘v8::Value::Int32Value()’
   int rowNumber = info[0]->Int32Value();
                                       ^
In file included from /home/brian/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:53,
                 from ../src/addon.h:4,
                 from ../src/connection.cc:1:
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2569:40: note: candidate: ‘v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const’
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2569:40: note:   candidate expects 1 argument, 0 provided
../src/connection.cc:231:39: error: no matching function for call to ‘v8::Value::Int32Value()’
   int colNumber = info[1]->Int32Value();
                                       ^
In file included from /home/brian/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:53,
                 from ../src/addon.h:4,
                 from ../src/connection.cc:1:
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2569:40: note: candidate: ‘v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const’
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2569:40: note:   candidate expects 1 argument, 0 provided
../src/connection.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Connection::Getisnull(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/connection.cc:248:39: error: no matching function for call to ‘v8::Value::Int32Value()’
   int rowNumber = info[0]->Int32Value();
                                       ^
In file included from /home/brian/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:53,
                 from ../src/addon.h:4,
                 from ../src/connection.cc:1:
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2569:40: note: candidate: ‘v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const’
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2569:40: note:   candidate expects 1 argument, 0 provided
../src/connection.cc:249:39: error: no matching function for call to ‘v8::Value::Int32Value()’
   int colNumber = info[1]->Int32Value();
                                       ^
In file included from /home/brian/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:53,
                 from ../src/addon.h:4,
                 from ../src/connection.cc:1:
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2569:40: note: candidate: ‘v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const’
   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
                                        ^~~~~~~~~~
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2569:40: note:   candidate expects 1 argument, 0 provided
../src/connection.cc: In static member function ‘static char* Connection::NewCString(v8::Local<v8::Value>)’:
../src/connection.cc:754:29: error: no matching function for call to ‘v8::String::Utf8Length()’
   int len = str->Utf8Length() + 1;
                             ^
In file included from /home/brian/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:53,
                 from ../src/addon.h:4,
                 from ../src/connection.cc:1:
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2678:7: note: candidate: ‘int v8::String::Utf8Length(v8::Isolate*) const’
   int Utf8Length(Isolate* isolate) const;
       ^~~~~~~~~~
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2678:7: note:   candidate expects 1 argument, 0 provided
../src/connection.cc:756:29: error: no matching function for call to ‘v8::String::WriteUtf8(char*&, int&)’
   str->WriteUtf8(buffer, len);
                             ^
In file included from /home/brian/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:53,
                 from ../src/addon.h:4,
                 from ../src/connection.cc:1:
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2738:7: note: candidate: ‘int v8::String::WriteUtf8(v8::Isolate*, char*, int, int*, int) const’
   int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
       ^~~~~~~~~
/home/brian/.node-gyp/12.2.0/include/node/v8.h:2738:7: note:   no known conversion for argument 1 from ‘char*’ to ‘v8::Isolate*’
../src/connection.cc: In member function ‘void Connection::Emit(const char*)’:
../src/connection.cc:804:46: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
   Nan::MakeCallback(handle(), emit_f, 1, info);
                                              ^
In file included from ../src/addon.h:4,
                 from ../src/connection.cc:1:
../node_modules/nan/nan.h:959:46: note: declared here
   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
                                              ^~~~~~~~~~~~
../src/connection.cc:804:46: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
   Nan::MakeCallback(handle(), emit_f, 1, info);
                                              ^
In file included from ../src/addon.h:4,
                 from ../src/connection.cc:1:
../node_modules/nan/nan.h:959:46: note: declared here
   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
                                              ^~~~~~~~~~~~
In file included from /home/brian/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:53,
                 from ../src/addon.h:4,
                 from ../src/connection.cc:1:
/home/brian/.node-gyp/12.2.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/brian/.node-gyp/12.2.0/include/node/node_object_wrap.h:84:78:   required from here
/home/brian/.node-gyp/12.2.0/include/node/v8.h:9817:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/brian/.node-gyp/12.2.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../node_modules/nan/nan_object_wrap.h:65:61:   required from here
/home/brian/.node-gyp/12.2.0/include/node/v8.h:9817:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
make: *** [addon.target.mk:111: Release/obj.target/addon/src/connection.o] Error 1
make: Leaving directory '/home/brian/.nvm/versions/node/v12.2.0/lib/node_modules/libpq/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/brian/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:257:12)
gyp ERR! System Linux 5.0.13-arch1-1-ARCH
gyp ERR! command "/home/brian/.nvm/versions/node/v12.2.0/bin/node" "/home/brian/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/brian/.nvm/versions/node/v12.2.0/lib/node_modules/libpq
gyp ERR! node -v v12.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! libpq@1.8.8 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the libpq@1.8.8 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/brian/.npm/_logs/2019-05-11T23_05_59_843Z-debug.log
joaool commented 5 years ago

on OSX, all up to date, node 12.3.1, npm install failed on the build process for libpq. The error messages are a little but different, don't know if that is the same issue as the previous one

libpq@1.8.8 install /Users/nicolas/flServer/node_modules/libpq node-gyp rebuild

CXX(target) Release/obj.target/addon/src/connection.o ../src/connection.cc:204:52: error: too few arguments to function call, single argument 'context' was not specified char* colName = PQfname(res, info[0]->Int32Value());


/Users/nicolas/.node-gyp/12.3.1/include/node/v8.h:2569:3: note: 'Int32Value' declared here
  V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
  ^
/Users/nicolas/.node-gyp/12.3.1/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/connection.cc:219:50: error: too few arguments to function call, single argument 'context' was not specified
  int colName = PQftype(res, info[0]->Int32Value());
                             ~~~~~~~~~~~~~~~~~~~ ^
/Users/nicolas/.node-gyp/12.3.1/include/node/v8.h:2569:3: note: 'Int32Value' declared here
  V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
  ^
/Users/nicolas/.node-gyp/12.3.1/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/connection.cc:230:39: error: too few arguments to function call, single argument 'context' was not specified
  int rowNumber = info[0]->Int32Value();
                  ~~~~~~~~~~~~~~~~~~~ ^
/Users/nicolas/.node-gyp/12.3.1/include/node/v8.h:2569:3: note: 'Int32Value' declared here
  V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
  ^
/Users/nicolas/.node-gyp/12.3.1/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/connection.cc:231:39: error: too few arguments to function call, single argument 'context' was not specified
  int colNumber = info[1]->Int32Value();
                  ~~~~~~~~~~~~~~~~~~~ ^
/Users/nicolas/.node-gyp/12.3.1/include/node/v8.h:2569:3: note: 'Int32Value' declared here
  V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
  ^
/Users/nicolas/.node-gyp/12.3.1/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/connection.cc:248:39: error: too few arguments to function call, single argument 'context' was not specified
  int rowNumber = info[0]->Int32Value();
                  ~~~~~~~~~~~~~~~~~~~ ^
/Users/nicolas/.node-gyp/12.3.1/include/node/v8.h:2569:3: note: 'Int32Value' declared here
  V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
  ^
/Users/nicolas/.node-gyp/12.3.1/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/connection.cc:249:39: error: too few arguments to function call, single argument 'context' was not specified
  int colNumber = info[1]->Int32Value();
                  ~~~~~~~~~~~~~~~~~~~ ^
/Users/nicolas/.node-gyp/12.3.1/include/node/v8.h:2569:3: note: 'Int32Value' declared here
  V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
  ^
/Users/nicolas/.node-gyp/12.3.1/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/connection.cc:754:29: error: too few arguments to function call, single argument 'isolate' was not specified
  int len = str->Utf8Length() + 1;
            ~~~~~~~~~~~~~~~ ^
/Users/nicolas/.node-gyp/12.3.1/include/node/v8.h:2678:3: note: 'Utf8Length' declared here
  int Utf8Length(Isolate* isolate) const;
  ^
../src/connection.cc:756:18: error: cannot initialize a parameter of type 'v8::Isolate *' with an lvalue of type 'char *'
  str->WriteUtf8(buffer, len);
                 ^~~~~~
/Users/nicolas/.node-gyp/12.3.1/include/node/v8.h:2738:26: note: passing argument to parameter 'isolate' here
  int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
                         ^
../src/connection.cc:804:8: warning: 'MakeCallback' is deprecated [-Wdeprecated-declarations]
  Nan::MakeCallback(handle(), emit_f, 1, info);
       ^
../../nan/nan.h:959:3: note: 'MakeCallback' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
  ^
../../nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
1 warning and 8 errors generated.
make: *** [Release/obj.target/addon/src/connection.o] Error 1
studorFL commented 4 years ago

This is still an issue on Node 12.14 as of today.

Reproduced on MacOS and the node:12-slim Docker image.

kriscarle commented 4 years ago

I got this error on MacOS when upgrade from node 10. Deleting package-lock.json and node_modules and doing a clean npm install resolved it.

This was with: libpq@1.8.9 Node 12.16.1 MacOS 10.15.2

andreisaikouski commented 2 years ago

I still have this issue.

Reproduced on MacOs and node:12.22.8-alpine