dturing / node-gstreamer-superficial

Superficial gstreamer binding
MIT License
127 stars 45 forks source link

node-gyp configure fails on debian beaglebone black. #4

Closed gregfutia closed 7 years ago

gregfutia commented 7 years ago

This may be related to issue #3.

I'm not that familiar with node-gyp. Should it resolve the dependencies? I'll try installing node-gyp and see if this clears this error.

Bash log: root@bone:/var/lib/cloud9/Projects/VideoServer/node-gstreamer-superficial# node-gyp configure gyp info it worked if it ends with ok gyp info using node-gyp@3.4.0 gyp info using node@0.12.17 | linux | arm gyp info spawn /usr/bin/python2 gyp info spawn args [ '/usr/local/lib/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 '/var/lib/cloud9/Projects/VideoServer/node-gstreamer-superficial/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/root/.node-gyp/0.12.17/include/node/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/0.12.17', gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=node.lib', gyp info spawn args '-Dmodule_root_dir=/var/lib/cloud9/Projects/VideoServer/node-gstreamer-superficial', 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=.' ] module.js:338 throw err; ^ Error: Cannot find module 'nan' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Module.require (module.js:365:17) at require (module.js:384:17) at [eval]:1:1 at Object.exports.runInThisContext (vm.js:74:17) at Object. ([eval]-wrapper:6:22) at Module._compile (module.js:460:26) at evalScript (node.js:431:25) at startup (node.js:90:7) gyp: Call to 'node -e "require('nan')"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:305:16) gyp ERR! stack at ChildProcess.emit (events.js:110:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1078:12) gyp ERR! System Linux 4.4.9-ti-r25 gyp ERR! command "node" "/usr/local/bin/node-gyp" "configure" gyp ERR! cwd /var/lib/cloud9/Projects/VideoServer/node-gstreamer-superficial gyp ERR! node -v v0.12.17 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok

gregfutia commented 7 years ago

I resolved the nan error by installing nan. $npm install nan --save in the cloned node-gstreamer-superficial directory. node-gyp configure now works.

I now get an error on node-gyp build: Log is

./GObjectWrap.cpp:78:39: note: candidate is: In file included from ../GObjectWrap.cpp:1:0: ../node_modules/nan/nan.h:369:23: note: template v8::Local Nan::EscapableHandleScope::Escape(v8::Local) inline v8::Local Escape(v8::Local value) { ^ ../node_modules/nan/nan.h:369:23: note: template argument deduction/substitution failed: ../GObjectWrap.cpp:78:39: note: ‘v8::Handle’ is not derived from ‘v8::Local’ scope.Escape( gvalue_to_v8( &gv ) ); ^ gstreamer-superficial.target.mk:104: recipe for target 'Release/obj.target/gstreamer-superficial/GObjectWrap.o' failed make: *** [Release/obj.target/gstreamer-superficial/GObjectWrap.o] Error 1 make: Leaving directory '/var/lib/cloud9/Projects/VideoServer/node-gstreamer-superficial/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/node-gyp/lib/build.js:276:23) gyp ERR! stack at ChildProcess.emit (events.js:110:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1078:12) gyp ERR! System Linux 4.4.9-ti-r25 gyp ERR! command "node" "/usr/local/bin/node-gyp" "build" gyp ERR! cwd /var/lib/cloud9/Projects/VideoServer/node-gstreamer-superficial gyp ERR! node -v v0.12.17 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok

dturing commented 7 years ago

i can't reproduce that error. it could help to use a later version of node (0.10.x is quite old nowadays). Did you see any progress yet?

gregfutia commented 7 years ago

I'm running on node. 0.12. I bet the issue is 0.10 to 0.12. I've been trying other packages to do this , mjpg-streamer , only to end up with build errors in the the node jpeg package.

I've determined that those build errors are related to an API change between 0.10 and 0.12 . It makes me think this is something similar.

Upcoming Breaking C++ API Changes in Node.js v0.12

gregfutia commented 7 years ago

Related to my first comment, I found out npm bundles a node-gyp which it uses on installs. Updating npm's bundled node gyp

npm install -g node-gyp is needed to build from the cloned git repository but is not need to install the npm package.

gregfutia commented 7 years ago

This might actually be something in nan.h and the changes in node from 0.10 to 0.12. Looking at the nan page they write, "Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect NODE_MODULE_VERSION and get yourself into a macro-tangle.."

The error is happening at line 78 in GObjectWrap.cpp: scope.Escape( gvalue_to_v8( &gv ) ) .

gvalue_to_v8 is defined line 42 of GLipHelpers.cpp. v8::Handle gvalue_to_v8( const GValue *gv ) { :

The second part of the message refers to nan.h line 369 which is the cpp template definition of Escape.

template inline v8::Local Escape(v8::Local value) { return scope.Escape(value); }

It's like there is an issue casting v8::Handle into v8::Local value .

Maybe this should be opened this on nan github project. Things shouldn't break on version upgrades. Otherwise, NODE_MODULE_VERSION might have to be inspected to do the right build.

dturing commented 7 years ago

please try with a newer node version (package.json states >=5.9.1; i dont get why the 0.12 branch still gets releases-- probably for debian? ;)

though nan was made exactly to ease those pesky v8 api breakage problems, i can't pretend i understand it all that very well ;)

gregfutia commented 7 years ago

Deiban stable for nodejs is listed as 0.10.29, Testing is 4.6.1. We have to go to experimental to get past version 5 (6.9.2) listed in experimental.

I installed node version manger , ran nvm install node which took me to version 7.4.0. Now $npm install gstreamer-superficial --save works.

When npm says update to the latest version of node I ran apt-get update, apt-get upgrade .