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

nan 2.12.0 caused error when building ref/ffi module against node 10 #835

Closed
belloyang opened this issue Dec 18, 2018 · 2 comments
Closed

Comments

@belloyang
Copy link

belloyang commented Dec 18, 2018

I am using electron-3.0.0 which is based on node 10 to build the ffi/ref dependency module. As the error log shows, the update in ../node_modules/nan/nan.h:1081 caused error: no matching function for call to ‘v8::String::WriteUtf8(v8::Isolate*, char*&, int, int, const int&), after checking the source code, it's the update from #if V8_MAJOR_VERSION >=7 to #if NODE_MAJOR_VERSION >= 10 that caused the problem.

Error Log:

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/local/bin/python2
gyp info spawn args [ '/usr/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   '/home/bingyang/Workspace/my_proj/node_modules/ffi/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/bingyang/.electron-gyp/.node-gyp/iojs-3.0.0/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/bingyang/.electron-gyp/.node-gyp/iojs-3.0.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/bingyang/.electron-gyp/.node-gyp/iojs-3.0.0/<(target_arch)/iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/bingyang/Workspace/my_proj/node_modules/ffi',
gyp info spawn args   '-Dnode_engine=v8',
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=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/home/bingyang/Workspace/my_proj/node_modules/ffi/build'
  CC(target) Release/obj.target/ffi/deps/libffi/src/prep_cif.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/types.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/raw_api.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/java_raw_api.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/closures.o
../deps/libffi/src/closures.c: In function ‘dlmmap_locked’:
../deps/libffi/src/closures.c:421:17: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result]
../deps/libffi/src/closures.c:433:17: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result]
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi64.o
../deps/libffi/src/x86/ffi64.c: In function ‘classify_argument’:
../deps/libffi/src/x86/ffi64.c:181:18: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/unix64.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/sysv.o
  AR(target) Release/obj.target/deps/libffi/libffi.a
  COPY Release/libffi.a
  CXX(target) Release/obj.target/ffi_bindings/src/ffi.o
In file included from ../src/ffi.h:23:0,
                 from ../src/ffi.cc:3:
../node_modules/nan/nan.h: In constructor ‘Nan::Utf8String::Utf8String(v8::Local<v8::Value>)’:
../node_modules/nan/nan.h:1081:101: error: no matching function for call to ‘v8::String::WriteUtf8(v8::Isolate*, char*&, int, int, const int&)’
         length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, static_cast<int>(len), 0, flags);
                                                                                                     ^
../node_modules/nan/nan.h:1081:101: note: candidate is:
In file included from /home/bingyang/.electron-gyp/.node-gyp/iojs-3.0.0/src/node.h:54:0,
                 from ../src/ffi.cc:1:
/home/bingyang/.electron-gyp/.node-gyp/iojs-3.0.0/deps/v8/include/v8.h:2590:7: note: int v8::String::WriteUtf8(char*, int, int*, int) const
   int WriteUtf8(char* buffer,
       ^
/home/bingyang/.electron-gyp/.node-gyp/iojs-3.0.0/deps/v8/include/v8.h:2590:7: note:   candidate expects 4 arguments, 5 provided
../src/ffi.cc: In static member function ‘static void FFI::FinishAsyncFFICall(uv_work_t*)’:
../src/ffi.cc:367:28: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated (declared at ../node_modules/nan/nan.h:1658) [-Wdeprecated-declarations]
   p->callback->Call(1, argv);
                            ^
make: *** [Release/obj.target/ffi_bindings/src/ffi.o] Error 1
make: Leaving directory `/home/bingyang/Workspace/my_proj/node_modules/ffi/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:262: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 Linux 4.4.0-31-generic
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild" "--target=3.0.0" "--arch=x64" "--dist-url=https://atom.io/download/electron"
gyp ERR! cwd /home/bingyang/Workspace/my_proj/node_modules/ffi
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

@Flarna
Copy link
Member

Flarna commented Dec 18, 2018

should be fixed by #833

@belloyang
Copy link
Author

This issue is fixed in the latest version 2.12.1

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