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

upgrade to NAN v2 #571

Closed
wants to merge 1 commit into from
Closed

Conversation

julianduque
Copy link

Getting ready for Node.js v4.0

@ChALkeR
Copy link
Contributor

ChALkeR commented Sep 13, 2015

Adding to the list: nodejs/node#2798.

tpl->PrototypeTemplate()->Set(NanNew<String>("start"),
NanNew<FunctionTemplate>(Start)->GetFunction());

NanAssignPersistent<FunctionTemplate>(serialportpoller_constructor, tpl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no reset?

@jacobrosenthal
Copy link
Contributor

This doesnt build for me on osx yosemite 0.10.38 (though it does on v0.12.4 and v4.0.0 )

  CXX(target) Release/obj.target/serialport/src/serialport.o
../src/serialport.cpp:363:16: error: no member named 'Reset' in 'v8::Persistent<v8::Object>'
  data->buffer.Reset();
  ~~~~~~~~~~~~ ^
../src/serialport.cpp:417:30: error: no member named 'Reset' in 'v8::Persistent<v8::Object>'
        del_q->baton->buffer.Reset();
        ~~~~~~~~~~~~~~~~~~~~ ^
../src/serialport.cpp:655:30: error: no matching constructor for initialization of 'Nan::Utf8String'
  Nan::Utf8String *str = new Nan::Utf8String(v8str);
                             ^               ~~~~~
../node_modules/nan/nan.h:1174:23: note: candidate constructor not viable: no known conversion from 'const v8::Handle<v8::String>' to
      'v8::Local<v8::Value>' for 1st argument
  NAN_INLINE explicit Utf8String(v8::Local<v8::Value> from) :
                      ^
../node_modules/nan/nan.h:1207:33: note: candidate constructor not viable: no known conversion from 'const v8::Handle<v8::String>' to
      'const Nan::Utf8String' for 1st argument
  NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String)
                                ^
../node_modules/nan/nan.h:109:23: note: expanded from macro 'NAN_DISALLOW_ASSIGN_COPY_MOVE'
    NAN_DISALLOW_COPY(CLASS)                                                   \
                      ^
../node_modules/nan/nan.h:91:35: note: expanded from macro 'NAN_DISALLOW_COPY'
# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&);

@fivdi
Copy link
Contributor

fivdi commented Sep 26, 2015

I performed some tests with this PR on the BeagleBone Black with two different test setups.

  1. Debian Wheezy, gcc/g++ 4.6, Node.js v0.10.38
    Result: compile errors on install (see below)

  2. Debian Jessie, gcc/g++ 4.9, Node.js v4.1.1
    Result: installed successfully and a simple test ran successfully

root@beaglebone:~/dev/pr571# node -v
v0.10.38
root@beaglebone:~/dev/pr571# uname -a
Linux beaglebone 3.8.13-bone70 #1 SMP Fri Jan 23 02:15:42 UTC 2015 armv7l GNU/Linux
root@beaglebone:~/dev/pr571# npm install "git://github.com/julianduque/node-serialport.git#master"
-
> serialport@1.7.4 install /root/dev/pr571/node_modules/serialport
> node-pre-gyp install --fallback-to-build

make: Entering directory `/root/dev/pr571/node_modules/serialport/build'
  CXX(target) Release/obj.target/serialport/src/serialport.o
../src/serialport.cpp: In function ‘void EIO_AfterWrite(uv_work_t*)’:
../src/serialport.cpp:363:16: error: ‘class v8::Persistent<v8::Object>’ has no member named ‘Reset’
../src/serialport.cpp: In function ‘void EIO_AfterClose(uv_work_t*)’:
../src/serialport.cpp:417:30: error: ‘class v8::Persistent<v8::Object>’ has no member named ‘Reset’
../src/serialport.cpp: In function ‘SerialPortParity ToParityEnum(const v8::Handle<v8::String>&)’:
../src/serialport.cpp:655:51: error: no matching function for call to ‘Nan::Utf8String::Utf8String(const v8::Handle<v8::String>&)’
../src/serialport.cpp:655:51: note: candidates are:
../node_modules/nan/nan.h:1207:3: note: Nan::Utf8String::Utf8String(const Nan::Utf8String&)
../node_modules/nan/nan.h:1207:3: note:   no known conversion for argument 1 from ‘const v8::Handle<v8::String>’ to ‘const Nan::Utf8String&’
../node_modules/nan/nan.h:1174:23: note: Nan::Utf8String::Utf8String(v8::Local<v8::Value>)
../node_modules/nan/nan.h:1174:23: note:   no known conversion for argument 1 from ‘const v8::Handle<v8::String>’ to ‘v8::Local<v8::Value>’
make: *** [Release/obj.target/serialport/src/serialport.o] Error 1
make: Leaving directory `/root/dev/pr571/node_modules/serialport/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 3.8.13-bone70
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "build" "--fallback-to-build" "--module=/root/dev/pr571/node_modules/serialport/build/serialport/v1.7.4/Release/node-v11-linux-arm/serialport.node" "--module_name=serialport" "--module_path=/root/dev/pr571/node_modules/serialport/build/serialport/v1.7.4/Release/node-v11-linux-arm"
gyp ERR! cwd /root/dev/pr571/node_modules/serialport
gyp ERR! node -v v0.10.38
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp build --fallback-to-build --module=/root/dev/pr571/node_modules/serialport/build/serialport/v1.7.4/Release/node-v11-linux-arm/serialport.node --module_name=serialport --module_path=/root/dev/pr571/node_modules/serialport/build/serialport/v1.7.4/Release/node-v11-linux-arm' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/root/dev/pr571/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:766:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:833:5)
node-pre-gyp ERR! System Linux 3.8.13-bone70
node-pre-gyp ERR! command "node" "/root/dev/pr571/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /root/dev/pr571/node_modules/serialport
node-pre-gyp ERR! node -v v0.10.38
node-pre-gyp ERR! node-pre-gyp -v v0.6.11
node-pre-gyp ERR! not ok 
Failed to execute 'node-gyp build --fallback-to-build --module=/root/dev/pr571/node_modules/serialport/build/serialport/v1.7.4/Release/node-v11-linux-arm/serialport.node --module_name=serialport --module_path=/root/dev/pr571/node_modules/serialport/build/serialport/v1.7.4/Release/node-v11-linux-arm' (1)
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! serialport@1.7.4 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the serialport@1.7.4 install script.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls serialport
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.8.13-bone70
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "git://github.com/julianduque/node-serialport.git#master"
npm ERR! cwd /root/dev/pr571
npm ERR! node -v v0.10.38
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /root/dev/pr571/npm-debug.log
npm ERR! not ok code 0
root@beaglebone:~/dev/pr571# 

@jacobrosenthal
Copy link
Contributor

Thanks for PR @julianduque, we ended up merging #566 as it got more work and testing for whatever reasons

@julianduque
Copy link
Author

@jacobrosenthal perfect 👏

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants