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

Resolve deprecation warnings #3

Closed
mikeokner opened this issue Jan 4, 2019 · 3 comments
Closed

Resolve deprecation warnings #3

mikeokner opened this issue Jan 4, 2019 · 3 comments

Comments

@mikeokner
Copy link
Owner

Latest builds on Travis are throwing deprecation warnings:

$ npm install
> [email protected] install /home/travis/build/mikeokner/posix-mq
> node-gyp rebuild
make: Entering directory `/home/travis/build/mikeokner/posix-mq/build'
  CXX(target) Release/obj.target/posixmq/src/posixmq.o
In file included from ../src/posixmq.cc:19:0:
../node_modules/nan/nan.h: In constructor ‘Nan::Utf8String::Utf8String(v8::Local<v8::Value>)’:
../node_modules/nan/nan.h:1064:78: warning: ‘v8::Local<v8::String> v8::Value::ToString(v8::Isolate*) const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:2537): Use maybe version [-Wdeprecated-declarations]
       v8::Local<v8::String> string = from->ToString(v8::Isolate::GetCurrent());
                                                                              ^
../src/posixmq.cc: In static member function ‘static void PosixMQ::poll_cb(uv_poll_t*, int, int)’:
../src/posixmq.cc:113:75: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated (declared at ../node_modules/nan/nan.h:958) [-Wdeprecated-declarations]
             Nan::MakeCallback(obj->handle(), emit, 1, read_emit_argv_local);
                                                                           ^
../src/posixmq.cc:130:76: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated (declared at ../node_modules/nan/nan.h:958) [-Wdeprecated-declarations]
             Nan::MakeCallback(obj->handle(), emit, 1, write_emit_argv_local);
                                                                            ^
../src/posixmq.cc: In static member function ‘static void PosixMQ::Open(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/posixmq.cc:185:58: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:10254): Use maybe version [-Wdeprecated-declarations]
         v8::Local<v8::Object> config = info[0]->ToObject();
                                                          ^
../src/posixmq.cc:195:42: warning: ‘bool v8::Value::BooleanValue() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:2568): Use maybe version [-Wdeprecated-declarations]
             doCreate = val->BooleanValue();
                                          ^
../src/posixmq.cc:202:42: warning: ‘uint32_t v8::Value::Uint32Value() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:2571): Use maybe version [-Wdeprecated-declarations]
                 flags = val->Uint32Value();
                                          ^
../src/posixmq.cc:225:49: warning: ‘uint32_t v8::Value::Uint32Value() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:2571): Use maybe version [-Wdeprecated-declarations]
                 mode = (mode_t)val->Uint32Value();
                                                 ^
../src/posixmq.cc:239:55: warning: ‘bool v8::Value::BooleanValue() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:2568): Use maybe version [-Wdeprecated-declarations]
             if (val->IsBoolean() && val->BooleanValue() == true) {
                                                       ^
../src/posixmq.cc:246:59: warning: ‘uint32_t v8::Value::Uint32Value() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:2571): Use maybe version [-Wdeprecated-declarations]
                 obj->mqattrs.mq_maxmsg = val->Uint32Value();
                                                           ^
../src/posixmq.cc:254:60: warning: ‘uint32_t v8::Value::Uint32Value() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:2571): Use maybe version [-Wdeprecated-declarations]
                 obj->mqattrs.mq_msgsize = val->Uint32Value();
                                                            ^
../src/posixmq.cc: In static member function ‘static void PosixMQ::Send(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/posixmq.cc:366:61: warning: ‘uint32_t v8::Value::Uint32Value() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:2571): Use maybe version [-Wdeprecated-declarations]
             if (info[1]->IsUint32() && info[1]->Uint32Value() < 32) {
                                                             ^
../src/posixmq.cc:367:49: warning: ‘uint32_t v8::Value::Uint32Value() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:2571): Use maybe version [-Wdeprecated-declarations]
                 priority = info[1]->Uint32Value();
                                                 ^
../src/posixmq.cc:377:85: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:10254): Use maybe version [-Wdeprecated-declarations]
             send_result = mq_send(obj->mqueue, node::Buffer::Data(info[0]->ToObject()),
                                                                                     ^
../src/posixmq.cc:378:56: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:10254): Use maybe version [-Wdeprecated-declarations]
                 node::Buffer::Length(info[0]->ToObject()), priority);
                                                        ^
../src/posixmq.cc: In static member function ‘static void PosixMQ::Receive(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/posixmq.cc:424:46: warning: ‘bool v8::Value::BooleanValue() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:2568): Use maybe version [-Wdeprecated-declarations]
             retTuple = info[1]->BooleanValue();
                                              ^
../src/posixmq.cc:427:55: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated (declared at /home/travis/.node-gyp/11.6.0/include/node/v8.h:10254): Use maybe version [-Wdeprecated-declarations]
         v8::Local<v8::Object> buf = info[0]->ToObject();
                                                       ^
  SOLINK_MODULE(target) Release/obj.target/posixmq.node
  COPY Release/posixmq.node
make: Leaving directory `/home/travis/build/mikeokner/posix-mq/build'
added 1 package from 8 contributors and audited 1 package in 2.912s
found 0 vulnerabilities
The command "npm install" exited with 0.
0.08s$ node test.js
Writing 100 ('d') to the queue...
Writing 98 ('b') to the queue...
Writing 56 ('8') to the queue...
Writing 40 ('(') to the queue...
Writing 62 ('>') to the queue...
Writing 108 ('l') to the queue...
Writing 41 (')') to the queue...
Writing 83 ('S') to the queue...
Writing 41 (')') to the queue...
Writing 125 ('}') to the queue...
Writing 70 ('F') to the queue...
(node:5840) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Received message (1 bytes): d
Messages left: 9
Received message (1 bytes): b
Messages left: 8
Received message (1 bytes): 8
Messages left: 7
Received message (1 bytes): (
Messages left: 6
Received message (1 bytes): >
Messages left: 5
Received message (1 bytes): l
Messages left: 4
Received message (1 bytes): )
Messages left: 3
Received message (1 bytes): S
Messages left: 2
Received message (1 bytes): )
Messages left: 1
Received message (1 bytes): }
Messages left: 0
The command "node test.js" exited with 0.

Hopefully possible to resolve while still maintaining full backwards compatibility. If not we can drop support for versions of Node that are no longer supported.

@PeterBurner
Copy link

posix-mq is not compatible to the current Node.js LTS v12.13.0 and needs to be updated!!

@mikeokner
Copy link
Owner Author

At @PeterBurner's beck & call, I resolved most of the deprecation warnings and got it building for Node v12 as well as prior versions, but it's now throwing a runtime error node: symbol lookup error: build/Release/posixmq.node: undefined symbol: mq_open only on >v12.

Could possibly be due to this change in Node? nodejs/node#29727

@mikeokner
Copy link
Owner Author

Rearranged library linking config in binding.gyp and it seems to be picking up librt appropriately for all versions of Node now.

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

2 participants