nodejs 使用gyp编译c程序出错
发布于 1 个月前 作者 mawubin 235 次浏览 来自 问答

求助各位大神 node-gyp configure build 编译一段c程序老是报错: /root/.node-gyp/5.0.0/include/node/v8.h: In function ‘v8::Handlev8::Value RunCallback(const int&)’: /root/.node-gyp/5.0.0/include/node/v8.h:889:13: error: ‘v8::HandleScope::HandleScope()’ is protected V8_INLINE HandleScope() {} ^ …/callback.cc:7:15: error: within this context HandleScope scope; ^ …/callback.cc:9:52: error: invalid types ‘const int[int]’ for array subscript Local<Function> cb = Local<Function>::Cast(args[0]); ^ …/callback.cc:11:49: error: ‘New’ is not a member of ‘v8::String’ Local<Value> argv[argc] = { Local<Value>::New(String::New(“hello world”)) }; ^ …/callback.cc:12:12: error: ‘GetCurrent’ is not a member of ‘v8::Context’ cb->Call(Context::GetCurrent()->Global(), argc, argv); ^ …/callback.cc:14:16: error: ‘class v8::HandleScope’ has no member named ‘Close’ return scope.Close(Undefined()); ^ …/callback.cc:14:32: error: too few arguments to function ‘v8::Localv8::Primitive v8::Undefined(v8::Isolate*)’ return scope.Close(Undefined()); ^ In file included from /root/.node-gyp/5.0.0/include/node/node.h:42:0, from …/callback.cc:2: /root/.node-gyp/5.0.0/include/node/v8.h:315:27: note: declared here friend Local<Primitive> Undefined(Isolate* isolate); ^ …/callback.cc: In function ‘void Init(v8::Handlev8::Object, v8::Handlev8::Object)’: …/callback.cc:18:15: error: ‘NewSymbol’ is not a member of ‘v8::String’ module->Set(String::NewSymbol(“exports”), ^ …/callback.cc:19:40: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handlev8::Value (&)(const int&))’ FunctionTemplate::New(RunCallback)->GetFunction()); ^ …/callback.cc:19:40: note: candidate is: In file included from /root/.node-gyp/5.0.0/include/node/node.h:42:0, from …/callback.cc:2: /root/.node-gyp/5.0.0/include/node/v8.h:4348:34: note: static v8::Localv8::FunctionTemplate v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Localv8::Value, v8::Localv8::Signature, int) static Local<FunctionTemplate> New( ^ /root/.node-gyp/5.0.0/include/node/v8.h:4348:34: note: no known conversion for argument 1 from ‘v8::Handlev8::Value(const int&) {aka v8::Localv8::Value(const int&)}’ to ‘v8::Isolate*’ …/callback.cc: In function ‘v8::Handlev8::Value RunCallback(const int&)’: …/callback.cc:15:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ make: *** [Release/obj.target/callback/callback.o] Error 1 make: Leaving directory /home/neil/Projects/Nodejs/cps_geddy/test/models/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 emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Linux 3.13.0-32-generic gyp ERR! command “/usr/local/bin/node” “/usr/local/bin/node-gyp” “configure” "build" gyp ERR! cwd /home/neil/Projects/Nodejs/cps_geddy/test/models gyp ERR! node -v v5.0.0 gyp ERR! node-gyp -v v3.3.1 gyp ERR! not ok 是咋回事? 试过重新获取g++,安装V8.目前的版本是:g++ 4.8.4

1 回复

应该是找到问题了,V8经历过一次大的升级,现在的版本已经不支持原来的写法了

回到顶部