Mar*_*ark 5 javascript c++ swig node.js
我使用一个非常简单的构建示例在 OSX 上设置 Swig,但遇到了编译错误 - 看起来 swig 包装器正在构建一堆底层 v8 系统根本不喜欢的代码。
我尝试将nodejs版本降低到8.xx但仍然没有成功。
有没有人遇到过类似的问题并找到了正确的解决方案?
Swig是4.0.3,通过brew还安装了v8查看brew节点是v8.17.0,通过nvm(或v12.18.0 - 系统默认)node-gyp是v7.0.0
CXX(target) Release/obj.target/example/example_wrap.o
../example_wrap.cxx:903:47: warning: 'NewFromUtf8' is deprecated: Use maybe version [-Wdeprecated-declarations]
SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_STRING_NEW(msg)));
^
../example_wrap.cxx:826:44: note: expanded from macro 'SWIGV8_STRING_NEW'
#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)
^
/Volumes/Data-4TB-2020/Users/mark/Library/Caches/node-gyp/12.18.0/include/node/v8.h:3030:10: note: 'NewFromUtf8' has been
explicitly marked deprecated here
static V8_DEPRECATED(
^
/Volumes/Data-4TB-2020/Users/mark/Library/Caches/node-gyp/12.18.0/include/node/v8config.h:328:29: note: expanded from macro
'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../example_wrap.cxx:938:7: error: no template named 'Handle' in namespace 'v8'
v8::Handle<v8::Value> err;
~~~~^
../example_wrap.cxx:933:32: warning: 'NewFromUtf8' is deprecated: Use maybe version [-Wdeprecated-declarations]
err = v8::Exception::Error(SWIGV8_STRING_NEW(msg));
^
../example_wrap.cxx:826:44: note: expanded from macro 'SWIGV8_STRING_NEW'
#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)
^
/Volumes/Data-4TB-2020/Users/mark/Library/Caches/node-gyp/12.18.0/include/node/v8.h:3030:10: note: 'NewFromUtf8' has been
explicitly marked deprecated here
static V8_DEPRECATED(
^
/Volumes/Data-4TB-2020/Users/mark/Library/Caches/node-gyp/12.18.0/include/node/v8config.h:328:29: note: expanded from macro
'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../example_wrap.cxx:1003:65: error: expected '(' for function-style cast or type construction
SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
~~~~~~~~~~^
../example_wrap.cxx:1003:48: error: no member named 'Handle' in namespace 'v8'
SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
~~~~^
../example_wrap.cxx:1003:67: error: use of undeclared identifier 'objRef'
SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
^
../example_wrap.cxx:1003:80: error: expected '(' for function-style cast or type construction
SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
~~~~ ^
../example_wrap.cxx:1003:82: error: use of undeclared identifier 'ptr'
SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
^
../example_wrap.cxx:1003:87: error: unexpected type name 'swig_type_info': expected expression
SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
^
../example_wrap.cxx:1003:103: error: use of undeclared identifier 'info'
SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
^
../example_wrap.cxx:1003:113: error: expected '(' for function-style cast or type construction
SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
~~~ ^
../example_wrap.cxx:1003:119: error: expected ';' after top level declarator
SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
^
;
../example_wrap.cxx:1276:1: warning: inline variables are a C++17 extension [-Wc++17-extensions]
SWIGRUNTIMEINLINE
^
../example_wrap.cxx:216:40: note: expanded from macro 'SWIGRUNTIMEINLINE'
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
^
../example_wrap.cxx:55:23: note: expanded from macro 'SWIGINLINE'
# define SWIGINLINE inline
^
../example_wrap.cxx:1277:44: error: expected '(' for function-style cast or type construction
int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
~~~~~~~~~^
../example_wrap.cxx:1277:28: error: no member named 'Handle' in namespace 'v8'
int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
~~~~^
../example_wrap.cxx:1277:46: error: use of undeclared identifier 'valRef'
int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
^
../example_wrap.cxx:1277:53: error: expected ';' after top level declarator
int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
^
;
../example_wrap.cxx:1472:17: error: no template named 'Handle' in namespace 'v8'
SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
~~~~^
../example_wrap.cxx:1476:31: warning: 'NewFromUtf8' is deprecated: Use maybe version [-Wdeprecated-declarations]
class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol));
^
../example_wrap.cxx:827:44: note: expanded from macro 'SWIGV8_SYMBOL_NEW'
#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym)
^
/Volumes/Data-4TB-2020/Users/mark/Library/Caches/node-gyp/12.18.0/include/node/v8.h:3030:10: note: 'NewFromUtf8' has been
explicitly marked deprecated here
static V8_DEPRECATED(
^
/Volumes/Data-4TB-2020/Users/mark/Library/Caches/node-gyp/12.18.0/include/node/v8config.h:328:29: note: expanded from macro
'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../example_wrap.cxx:1478:34: error: expected '(' for function-style cast or type construction
v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
~~~~~~~~~~~~~~~~~~^
../example_wrap.cxx:1478:9: error: no member named 'Handle' in namespace 'v8'
v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
~~~~^
../example_wrap.cxx:1478:36: error: use of undeclared identifier 'inst_templ'; did you mean 'class_templ'?
v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
^~~~~~~~~~
class_templ
../example_wrap.cxx:1475:37: note: 'class_templ' declared here
v8::Local<v8::FunctionTemplate> class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID();
^
../example_wrap.cxx:1479:5: error: use of undeclared identifier 'inst_templ'
inst_templ->SetInternalFieldCount(1);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
4 warnings and 20 errors generated.
make: *** [Release/obj.target/example/example_wrap.o] Error 1
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:194:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 19.5.0
gyp ERR! command "/Volumes/Data-4TB-2020/Users/mark/.nvm/versions/node/v8.17.0/bin/node" "/usr/local/bin/node-gyp" "build"
gyp ERR! cwd /Volumes/Data-4TB-2020/Users/mark/Development/node/fcpx
gyp ERR! node -v v8.17.0
gyp ERR! node-gyp -v v7.0.0
gyp ERR! not ok
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
267 次 |
| 最近记录: |