I want to call a cpp function in javascript file (both are located in custom plugin), tried this youtube link. I ran into some issues and I tried to install the requirements as mentioned in this stackoverflow link.
I ran cordova run electron
and also ./node_modules/.bin/electron-rebuild
. Still Iam unable to find a fix for this. Can someone help me. Thanks in advance.
This is my build.log file
804 verbose stack Error: command failed
804 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
804 verbose stack at ChildProcess.emit (events.js:315:20)
804 verbose stack at maybeClose (internal/child_process.js:1048:16)
804 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
805 verbose pkgid ffi-napi@4.0.1
806 verbose cwd /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www
807 verbose Linux 5.8.0-38-generic
808 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "install" "--production" "--cache-min" "999999999"
809 verbose node v14.16.0
810 verbose npm v7.6.1
811 error code 1
812 error path /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/ffi-napi
813 error command failed
814 error command sh -c node-gyp-build
815 error make: Entering directory '/home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/ffi-napi/build'
815 error CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
815 error AR(target) Release/obj.target/../node-addon-api/nothing.a
815 error COPY Release/nothing.a
815 error CC(target) Release/obj.target/ffi/deps/libffi/src/prep_cif.o
815 error CC(target) Release/obj.target/ffi/deps/libffi/src/types.o
815 error CC(target) Release/obj.target/ffi/deps/libffi/src/raw_api.o
815 error CC(target) Release/obj.target/ffi/deps/libffi/src/java_raw_api.o
815 error CC(target) Release/obj.target/ffi/deps/libffi/src/closures.o
815 error CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffiw64.o
815 error CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi64.o
815 error CC(target) Release/obj.target/ffi/deps/libffi/src/x86/unix64.o
815 error CC(target) Release/obj.target/ffi/deps/libffi/src/x86/win64.o
815 error AR(target) Release/obj.target/deps/libffi/libffi.a
815 error COPY Release/libffi.a
815 error CXX(target) Release/obj.target/ffi_bindings/src/ffi.o
815 error make: Leaving directory '/home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/ffi-napi/build'
816 error gyp info it worked if it ends with ok
816 error gyp info using node-gyp@7.1.2
816 error gyp info using node@14.16.0 | linux | x64
816 error gyp info find Python using Python version 3.8.5 found at "/usr/bin/python3"
816 error gyp info spawn /usr/bin/python3
816 error gyp info spawn args [
816 error gyp info spawn args '/home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-gyp/gyp/gyp_main.py',
816 error gyp info spawn args 'binding.gyp',
816 error gyp info spawn args '-f',
816 error gyp info spawn args 'make',
816 error gyp info spawn args '-I',
816 error gyp info spawn args '/home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/ffi-napi/build/config.gypi',
816 error gyp info spawn args '-I',
816 error gyp info spawn args '/home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-gyp/addon.gypi',
816 error gyp info spawn args '-I',
816 error gyp info spawn args '/home/hrushi/.electron-gyp/4.0.1/include/node/common.gypi',
816 error gyp info spawn args '-Dlibrary=shared_library',
816 error gyp info spawn args '-Dvisibility=default',
816 error gyp info spawn args '-Dnode_root_dir=/home/hrushi/.electron-gyp/4.0.1',
816 error gyp info spawn args '-Dnode_gyp_dir=/home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-gyp',
816 error gyp info spawn args '-Dnode_lib_file=/home/hrushi/.electron-gyp/4.0.1/<(target_arch)/node.lib',
816 error gyp info spawn args '-Dmodule_root_dir=/home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/ffi-napi',
816 error gyp info spawn args '-Dnode_engine=v8',
816 error gyp info spawn args '--depth=.',
816 error gyp info spawn args '--no-parallel',
816 error gyp info spawn args '--generator-output',
816 error gyp info spawn args 'build',
816 error gyp info spawn args '-Goutput_dir=.'
816 error gyp info spawn args ]
816 error gyp info spawn make
816 error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
816 error ../deps/libffi/src/java_raw_api.c: In function ‘ffi_java_raw_call’:
816 error ../deps/libffi/src/java_raw_api.c:317:3: warning: ‘ffi_java_raw_to_ptrarray’ is deprecated [-Wdeprecated-declarations]
816 error 317 | ffi_java_raw_to_ptrarray (cif, raw, avalue);
816 error | ^~~~~~~~~~~~~~~~~~~~~~~~
816 error ../deps/libffi/src/java_raw_api.c:76:1: note: declared here
816 error 76 | ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args)
816 error | ^~~~~~~~~~~~~~~~~~~~~~~~
816 error ../deps/libffi/src/java_raw_api.c: In function ‘ffi_java_translate_args’:
816 error ../deps/libffi/src/java_raw_api.c:328:3: warning: ‘ffi_java_raw_size’ is deprecated [-Wdeprecated-declarations]
816 error 328 | ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif));
816 error | ^~~~~~~~~~~~
816 error ../deps/libffi/src/java_raw_api.c:45:1: note: declared here
816 error 45 | ffi_java_raw_size (ffi_cif *cif)
816 error | ^~~~~~~~~~~~~~~~~
816 error ../deps/libffi/src/java_raw_api.c:331:3: warning: ‘ffi_java_ptrarray_to_raw’ is deprecated [-Wdeprecated-declarations]
816 error 331 | ffi_java_ptrarray_to_raw (cif, avalue, raw);
816 error | ^~~~~~~~~~~~~~~~~~~~~~~~
816 error ../deps/libffi/src/java_raw_api.c:157:1: note: declared here
816 error 157 | ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw)
816 error | ^~~~~~~~~~~~~~~~~~~~~~~~
816 error ../deps/libffi/src/java_raw_api.c: In function ‘ffi_prep_java_raw_closure’:
816 error ../deps/libffi/src/java_raw_api.c:369:3: warning: ‘ffi_prep_java_raw_closure_loc’ is deprecated [-Wdeprecated-declarations]
816 error 369 | return ffi_prep_java_raw_closure_loc (cl, cif, fun, user_data, cl);
816 error | ^~~~~~
816 error ../deps/libffi/src/java_raw_api.c:337:1: note: declared here
816 error 337 | ffi_prep_java_raw_closure_loc (ffi_java_raw_closure* cl,
816 error | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
816 error ../deps/libffi/src/closures.c: In function ‘allocate_space’:
816 error ../deps/libffi/src/closures.c:748:29: warning: comparison of integer expressions of different signedness: ‘off_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
816 error 748 | off_t to_write = (len < page_size) ? len : page_size;
816 error | ^
816 error ../deps/libffi/src/closures.c:748:44: warning: operand of ?: changes signedness from ‘off_t’ {aka ‘long int’} to ‘size_t’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Wsign-compare]
816 error 748 | off_t to_write = (len < page_size) ? len : page_size;
816 error | ^~~
816 error ../deps/libffi/src/x86/ffi64.c: In function ‘classify_argument’:
816 error ../deps/libffi/src/x86/ffi64.c:200:18: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
816 error 200 | FFI_ASSERT (0);
816 error | ^
816 error ../deps/libffi/src/x86/ffi64.c:175:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
816 error 175 | {
816 error | ^
816 error ../deps/libffi/src/x86/ffi64.c:202:5: note: here
816 error 202 | case FFI_TYPE_FLOAT:
816 error | ^~~~
816 error In file included from /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-addon-api/napi.h:2636,
816 error from ../src/ffi.h:2,
816 error from ../src/ffi.cc:3:
816 error /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-addon-api/napi-inl.h: In member function ‘T* Napi::Env::GetInstanceData()’:
816 error /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-addon-api/napi-inl.h:469:24: error: there are no arguments to ‘napi_get_instance_data’ that depend on a template parameter, so a declaration of ‘napi_get_instance_data’ must be available [-fpermissive]
816 error 469 | napi_status status = napi_get_instance_data(_env, &data);
816 error | ^~~~~~~~~~~~~~~~~~~~~~
816 error /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-addon-api/napi-inl.h:469:24: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
816 error /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-addon-api/napi-inl.h: In member function ‘bool Napi::Value::IsDate() const’:
816 error /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-addon-api/napi-inl.h:562:24: error: ‘napi_is_date’ was not declared in this scope; did you mean ‘napi_is_dataview’?
816 error 562 | napi_status status = napi_is_date(_env, _value, &result);
816 error | ^~~~~~~~~~~~
816 error | napi_is_dataview
816 error /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-addon-api/napi-inl.h: In static member function ‘static Napi::Date Napi::Date::New(napi_env, double)’:
816 error /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-addon-api/napi-inl.h:854:24: error: ‘napi_create_date’ was not declared in this scope; did you mean ‘napi_create_dataview’?
816 error 854 | napi_status status = napi_create_date(env, val, &value);
816 error | ^~~~~~~~~~~~~~~~
816 error | napi_create_dataview
816 error /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-addon-api/napi-inl.h: In member function ‘double Napi::Date::ValueOf() const’:
816 error /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-addon-api/napi-inl.h:871:24: error: ‘napi_get_date_value’ was not declared in this scope; did you mean ‘napi_get_reference_value’?
816 error 871 | napi_status status = napi_get_date_value(
816 error | ^~~~~~~~~~~~~~~~~~~
816 error | napi_get_reference_value
816 error ../src/ffi.cc: In static member function ‘static FFI::InstanceData* FFI::InstanceData::Get(Napi::Env)’:
816 error ../src/ffi.cc:11:24: error: ‘napi_get_instance_data’ was not declared in this scope; did you mean ‘napi_new_instance’?
816 error 11 | napi_status status = napi_get_instance_data(env, &d);
816 error | ^~~~~~~~~~~~~~~~~~~~~~
816 error | napi_new_instance
816 error ../src/ffi.cc: In function ‘Napi::Object BindingHook(Napi::Env, Napi::Object)’:
816 error ../src/ffi.cc:348:24: error: ‘napi_set_instance_data’ was not declared in this scope; did you mean ‘napi_new_instance’?
816 error 348 | napi_status status = napi_set_instance_data(
816 error | ^~~~~~~~~~~~~~~~~~~~~~
816 error | napi_new_instance
816 error make: *** [ffi_bindings.target.mk:114: Release/obj.target/ffi_bindings/src/ffi.o] Error 1
816 error gyp ERR! build error
816 error gyp ERR! stack Error: `make` failed with exit code: 2
816 error gyp ERR! stack at ChildProcess.onExit (/home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/node-gyp/lib/build.js:194:23)
816 error gyp ERR! stack at ChildProcess.emit (events.js:315:20)
816 error gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
816 error gyp ERR! System Linux 5.8.0-38-generic
816 error gyp ERR! command "/usr/bin/node" "/home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/.bin/node-gyp" "rebuild"
816 error gyp ERR! cwd /home/hrushi/Desktop/Hrushikesh/Maigha/Projects/MaiCoStudio/MaiCoStudioCordova/platforms/electron/www/node_modules/ffi-napi
816 error gyp ERR! node -v v14.16.0
816 error gyp ERR! node-gyp -v v7.1.2
816 error gyp ERR! not ok
817 verbose exit 1