dashersw / brain-bits

A P300 online spelling mechanism for Emotiv headsets. It's completely written in Node.js, and the GUI is based on Electron and Vue.
MIT License
174 stars 25 forks source link

Problems when installing on Ubuntu 18.04 #2

Open titusfx opened 5 years ago

titusfx commented 5 years ago

Hi,

I installed https://www.ubuntuupdates.org/package/core/bionic/universe/base/libhidapi-dev https://www.ubuntuupdates.org/package/core/bionic/universe/base/libhidapi-hidraw0 https://www.ubuntuupdates.org/package/core/bionic/universe/base/libhidapi-libusb0

Trying to install dependency packages.

Then it throw an exception withe the message of can't find lblas on /user/bin/ld, i believe that was fixed with:

sudo apt-get install libblas-dev liblapack-dev

But now I'm getting this error (which it seem that you fixed here): https://github.com/nodejs/node-addon-api/issues/173 and https://github.com/dashersw/brain-bits/blob/master/lib/bindings.cc , but it doesn't for me ).

npm install

> brain-bits@1.0.0 install /home/a-user-name/Projects/testing/brain-bits
> node-gyp rebuild

make: Entering directory '/home/a-user-name/Projects/testing/brain-bits/build'
  SOLINK_MODULE(target) Release/obj.target/node_modules/node-addon-api/src/nothing.node
  COPY Release/nothing.node
  CXX(target) Release/obj.target/emotiv/lib/bindings.o
In file included from /home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi.h:1449:0,
                 from ../lib/bindings.cc:7:
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h: In member function ‘Napi::Value Napi::Function::MakeCallback(napi_value, size_t, napi_value__* const*) const’:
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h:1277:44: error: cannot convert ‘napi_value {aka napi_value__*}’ to ‘napi_async_context {aka napi_async_context__*}’ for argument ‘2’ to ‘napi_status napi_make_callback(napi_env, napi_async_context, napi_value, napi_value, size_t, napi_value__* const*, napi_value__**)’
     _env, recv, _value, argc, args, &result);
                                            ^
In file included from /usr/include/nodejs/src/node_api.h:15:0,
                 from /home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi.h:4,
                 from ../lib/bindings.cc:7:
/usr/include/nodejs/src/node_api_types.h:14:16: note: class type ‘napi_value__’ is incomplete
 typedef struct napi_value__ *napi_value;
                ^~~~~~~~~~~~
In file included from /home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi.h:1449:0,
                 from ../lib/bindings.cc:7:
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h: In static member function ‘static void Napi::Error::Fatal(const char*, const char*)’:
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h:1484:37: error: invalid conversion from ‘const char*’ to ‘size_t {aka long unsigned int}’ [-fpermissive]
   napi_fatal_error(location, message);
                                     ^
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h:1484:37: error: too few arguments to function ‘void napi_fatal_error(const char*, size_t, const char*, size_t)’
In file included from /home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi.h:4:0,
                 from ../lib/bindings.cc:7:
/usr/include/nodejs/src/node_api.h:115:33: note: declared here
 NAPI_EXTERN NAPI_NO_RETURN void napi_fatal_error(const char* location,
                                 ^~~~~~~~~~~~~~~~
In file included from /home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi.h:1449:0,
                 from ../lib/bindings.cc:7:
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h: In member function ‘bool Napi::CallbackInfo::IsConstructCall() const’:
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h:2020:24: error: ‘napi_is_construct_call’ was not declared in this scope
   napi_status status = napi_is_construct_call(_env, _info, &isConstructCall);
                        ^~~~~~~~~~~~~~~~~~~~~~
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h:2020:24: note: suggested alternative: ‘isConstructCall’
   napi_status status = napi_is_construct_call(_env, _info, &isConstructCall);
                        ^~~~~~~~~~~~~~~~~~~~~~
                        isConstructCall
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h: In static member function ‘static napi_value__* Napi::ObjectWrap<T>::ConstructorCallbackWrapper(napi_env, napi_callback_info)’:
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h:2474:24: error: there are no arguments to ‘napi_is_construct_call’ that depend on a template parameter, so a declaration of ‘napi_is_construct_call’ must be available [-fpermissive]
   napi_status status = napi_is_construct_call(env, info, &isConstructCall);
                        ^~~~~~~~~~~~~~~~~~~~~~
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h:2474:24: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h: In constructor ‘Napi::AsyncWorker::AsyncWorker(const Napi::Object&, const Napi::Function&)’:
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h:2684:50: error: cannot convert ‘void (*)(napi_env, void*) {aka void (*)(napi_env__*, void*)}’ to ‘napi_value {aka napi_value__*}’ for argument ‘2’ to ‘napi_status napi_create_async_work(napi_env, napi_value, napi_value, napi_async_execute_callback, napi_async_complete_callback, void*, napi_async_work__**)’
     _env, OnExecute, OnWorkComplete, this, &_work);
                                                  ^
../lib/bindings.cc: In function ‘void Complete(napi_env, napi_status, void*)’:
../lib/bindings.cc:197:67: error: cannot convert ‘napi_value {aka napi_value__*}’ to ‘napi_async_context {aka napi_async_context__*}’ for argument ‘2’ to ‘napi_status napi_make_callback(napi_env, napi_async_context, napi_value, napi_value, size_t, napi_value__* const*, napi_value__**)’
     s = napi_make_callback(env, global, callback, 2, argv, &result);
                                                                   ^
In file included from /usr/include/nodejs/src/node_api.h:15:0,
                 from /home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi.h:4,
                 from ../lib/bindings.cc:7:
/usr/include/nodejs/src/node_api_types.h:14:16: note: class type ‘napi_value__’ is incomplete
 typedef struct napi_value__ *napi_value;
                ^~~~~~~~~~~~
../lib/bindings.cc: In function ‘napi_value__* read(napi_env, napi_callback_info)’:
../lib/bindings.cc:224:96: error: cannot convert ‘void (*)(napi_env, void*) {aka void (*)(napi_env__*, void*)}’ to ‘napi_value {aka napi_value__*}’ for argument ‘2’ to ‘napi_status napi_create_async_work(napi_env, napi_value, napi_value, napi_async_execute_callback, napi_async_complete_callback, void*, napi_async_work__**)’
 create_async_work(env, Execute, Complete, &the_carrier, &the_carrier._request);
                                                                              ^
../lib/bindings.cc: In function ‘void CancelComplete(napi_env, napi_status, void*)’:
../lib/bindings.cc:256:74: error: cannot convert ‘napi_value {aka napi_value__*}’ to ‘napi_async_context {aka napi_async_context__*}’ for argument ‘2’ to ‘napi_status napi_make_callback(napi_env, napi_async_context, napi_value, napi_value, size_t, napi_value__* const*, napi_value__**)’
         s = napi_make_callback(env, global, callback, 0, nullptr, &result);
                                                                          ^
In file included from /usr/include/nodejs/src/node_api.h:15:0,
                 from /home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi.h:4,
                 from ../lib/bindings.cc:7:
/usr/include/nodejs/src/node_api_types.h:14:16: note: class type ‘napi_value__’ is incomplete
 typedef struct napi_value__ *napi_value;
                ^~~~~~~~~~~~
../lib/bindings.cc: In function ‘napi_value__* TestCancel(napi_env, napi_callback_info)’:
../lib/bindings.cc:284:106: error: cannot convert ‘void (*)(napi_env, void*) {aka void (*)(napi_env__*, void*)}’ to ‘napi_value {aka napi_value__*}’ for argument ‘2’ to ‘napi_status napi_create_async_work(napi_env, napi_value, napi_value, napi_async_execute_callback, napi_async_complete_callback, void*, napi_async_work__**)’
             BusyCancelComplete, &async_carrier[i], &async_carrier[i]._request);
                                                                              ^
../lib/bindings.cc:298:98: error: cannot convert ‘void (*)(napi_env, void*) {aka void (*)(napi_env__*, void*)}’ to ‘napi_value {aka napi_value__*}’ for argument ‘2’ to ‘napi_status napi_create_async_work(napi_env, napi_value, napi_value, napi_async_execute_callback, napi_async_complete_callback, void*, napi_async_work__**)’
                 CancelComplete, &async_carrier[0], &async_carrier[0]._request);
                                                                              ^
In file included from /home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi.h:4:0,
                 from ../lib/bindings.cc:7:
../lib/bindings.cc: At global scope:
/usr/include/nodejs/src/node_api.h:96:5: error: invalid conversion from ‘void (*)(napi_env, napi_value, napi_value, void*) {aka void (*)(napi_env__*, napi_value__*, napi_value__*, void*)}’ to ‘napi_addon_register_func {aka napi_value__* (*)(napi_env__*, napi_value__*)}’ [-fpermissive]
     };                                                                \
     ^
/usr/include/nodejs/src/node_api.h:103:3: note: in expansion of macro ‘NAPI_MODULE_X’
   NAPI_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../lib/bindings.cc:334:1: note: in expansion of macro ‘NAPI_MODULE’
 NAPI_MODULE(addon, Init)
 ^~~~~~~~~~~
In file included from /home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi.h:1449:0,
                 from ../lib/bindings.cc:7:
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h: In static member function ‘static void Napi::Error::Fatal(const char*, const char*)’:
/home/a-user-name/Projects/testing/brain-bits/node_modules/node-addon-api/napi-inl.h:1485:1: warning: ‘noreturn’ function does return
 }
 ^
emotiv.target.mk:105: recipe for target 'Release/obj.target/emotiv/lib/bindings.o' failed
make: *** [Release/obj.target/emotiv/lib/bindings.o] Error 1
make: Leaving directory '/home/a-user-name/Projects/testing/brain-bits/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:258: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.15.0-45-generic
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/a-user-name/Projects/testing/brain-bits
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

the same happens with your other project

I just bougth the emotiv but i can't make it work :(

dashersw commented 5 years ago

Hi! Are you using node version 8? I believe node version 10 won't work with this project because of the changes in N-API.

dashersw commented 5 years ago

Hm, in fact you are using node v8.10.0. Strange. I'll try to look more into this.

dashersw commented 5 years ago

Have you tried installing wits? If you can install that, I think we can update this repo to use wits.

titusfx commented 5 years ago

Hi! Yes, I did. I got first fatal: destination path 'lib/emokit-c' already exists and is not an empty directory. then I did rm -r lib/emokit-c as you suggest here: . And know I facing a similar issue the output is different though, but the error occurs with node-gyp build and/or node-gyp rebuild. I will post it on wits issues.