alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
8.06k stars 1.11k forks source link

Build error npm install --kaldi_root=<my kaldi root> #161

Closed 51N4 closed 3 years ago

51N4 commented 4 years ago

Getting
error: cannot use 'throw' with exceptions disabled error: cannot use 'try' with exceptions disabled

When running npm install on vosk-api although kaldi compiling according to the instructions.

nshmyrev commented 4 years ago

Please update and check if this commit:

https://github.com/alphacep/vosk-api/commit/c2e006f6649773997b9785692afb49dafacd517c

fixes build for you

51N4 commented 4 years ago

It starts compiling the kaldi source now, thanks you. : ) But now there is another error:

SOLINK_MODULE(target) Release/vosk.node clang: error: no such file or directory: 'Release/obj.target/vosk/vosk_wrap.o' make: *** [Release/vosk.node] Error 1

51N4 commented 4 years ago

I also noticed this is package file.

Is this accurate that it uses Pocketsphinx for this build?

"name": "vosk", "version": "0.3.8", "description": "Node binding for continuous voice recoginition through pocketsphinx.", "repository": { "type": "git", "url": "git://github.com/alphacep/vosk-api.git" },

nshmyrev commented 4 years ago

clang: error: no such file or directory: 'Release/obj.target/vosk/vosk_wrap.o'

There was an earlier error with swig, you need to check the full log

Is this accurate that it uses Pocketsphinx for this build?

Fixed, thank you

51N4 commented 4 years ago

Here are the error logs:

error_log.txt

//These are the errors in the

../vosk_wrap.cc:938:7: error: no template named 'Handle' in namespace 'v8' v8::Handle err;


../vosk_wrap.cc:933:32: warning: 'NewFromUtf8' is deprecated: Use maybe version [-Wdeprecated-declarations]
    err = v8::Exception::Error(SWIGV8_STRING_NEW(msg));
                               ^
../vosk_wrap.cc:826:44: note: expanded from macro 'SWIGV8_STRING_NEW'
#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)
                                           ^
/Users/m4m4/Library/Caches/node-gyp/12.16.1/include/node/v8.h:3030:10: note: 'NewFromUtf8' has been explicitly marked deprecated here
  static V8_DEPRECATED(
         ^
/Users/m4m4/Library/Caches/node-gyp/12.16.1/include/node/v8config.h:328:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
../vosk_wrap.cc: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) {
                                                      ~~~~~~~~~~^
../vosk_wrap.cc: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) {
                                           ~~~~^
../vosk_wrap.cc: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) {
                                                                  ^
../vosk_wrap.cc: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) {
                                                                          ~~~~ ^
../vosk_wrap.cc: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) {
                                                                                 ^
../vosk_wrap.cc: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) {
                                                                                      ^
../vosk_wrap.cc: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) {
                                                                                                      ^
../vosk_wrap.cc: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) {
                                                                                                            ~~~ ^
../vosk_wrap.cc: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) {
                                                                                                                      ^
                                                                                                                      ;
../vosk_wrap.cc:1276:1: warning: inline variables are a C++17 extension [-Wc++17-extensions]
SWIGRUNTIMEINLINE
^
../vosk_wrap.cc:216:40: note: expanded from macro 'SWIGRUNTIMEINLINE'
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
                                       ^
../vosk_wrap.cc:60:23: note: expanded from macro 'SWIGINLINE'
#   define SWIGINLINE inline
                      ^
../vosk_wrap.cc:1277:44: error: expected '(' for function-style cast or type construction
int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
                                  ~~~~~~~~~^
../vosk_wrap.cc:1277:28: error: no member named 'Handle' in namespace 'v8'
int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
                       ~~~~^
../vosk_wrap.cc:1277:46: error: use of undeclared identifier 'valRef'
int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
                                             ^
../vosk_wrap.cc:1277:53: error: expected ';' after top level declarator
int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
                                                    ^
                                                    ;
../vosk_wrap.cc:1472:17: error: no template named 'Handle' in namespace 'v8'
SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
            ~~~~^
../vosk_wrap.cc:1476:31: warning: 'NewFromUtf8' is deprecated: Use maybe version [-Wdeprecated-declarations]
    class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol));
                              ^
../vosk_wrap.cc:827:44: note: expanded from macro 'SWIGV8_SYMBOL_NEW'
#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym)
                                           ^
/Users/m4m4/Library/Caches/node-gyp/12.16.1/include/node/v8.h:3030:10: note: 'NewFromUtf8' has been explicitly marked deprecated here
  static V8_DEPRECATED(
         ^
/Users/m4m4/Library/Caches/node-gyp/12.16.1/include/node/v8config.h:328:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
../vosk_wrap.cc:1478:34: error: expected '(' for function-style cast or type construction
    v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
               ~~~~~~~~~~~~~~~~~~^
../vosk_wrap.cc:1478:9: error: no member named 'Handle' in namespace 'v8'
    v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
    ~~~~^
../vosk_wrap.cc: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
../vosk_wrap.cc:1475:37: note: 'class_templ' declared here
    v8::Local<v8::FunctionTemplate> class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID();
                                    ^
../vosk_wrap.cc: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/vosk/vosk_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/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/m4m4/Documents/vosk-api/nodejs
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vosk@0.3.8 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vosk@0.3.8 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/m4m4/.npm/_logs/2020-07-12T09_06_54_680Z-debug.log (This error log in the txt file)

nodejs m4m4$ swig -version

SWIG Version 4.0.2

Compiled with clang++ [x86_64-apple-darwin19.5.0]

Configured options: +pcre

Please see http://www.swig.org for reporting bugs and further information
nshmyrev commented 4 years ago

Try with node 10, 12 seems not yet supported by swig.

51N4 commented 4 years ago

Ah, had to use nvm to set a node version and it compiled. Much appreciated on a Sunday!

🙏🏻🤟🏻👏🏻

nshmyrev commented 3 years ago

Hopefully we'll write NAPI bindings one day, lets track it in https://github.com/alphacep/vosk-api/issues/116