cmusphinx / node-pocketsphinx

Pocketsphinx bindings for Node.JS
Other
242 stars 47 forks source link

Error with node-gyp on building #8

Closed joshbirk closed 9 years ago

joshbirk commented 9 years ago

I can't seem to get it to build with sphinxbase5prerel and the latest version of pocketsphinx from github. I just reran make on both and those installs have no errors under make check. However when npm tries to run the node-gyp I get:

../src/Recognizer.cpp:23:67: error: use of undeclared identifier 'MODELDIR' tpl->Set(String::NewSymbol("modelDirectory"), String::NewSymbol(MODELDIR)); ^ ../src/Recognizer.cpp:73:97: error: use of undeclared identifier 'MODELDIR' String::AsciiValue hmmValue(Default(options->Get(String::NewSymbol("hmm")), String::NewSymbol(MODELDIR "/hmm/en_US/hub4wsj_sc_8k"))); ^ ../src/Recognizer.cpp:74:95: error: use of undeclared identifier 'MODELDIR' String::AsciiValue lmValue(Default(options->Get(String::NewSymbol("lm")), String::NewSymbol(MODELDIR "/lm/en_US/hub4.5000.DMP"))); ^ ../src/Recognizer.cpp:75:99: error: use of undeclared identifier 'MODELDIR' String::AsciiValue dictValue(Default(options->Get(String::NewSymbol("dict")), String::NewSymbol(MODELDIR "/lm/en_US/cmu07a.dic"))); ^ ../src/Recognizer.cpp:215:16: error: no matching function for call to 'ps_start_utt' int result = ps_start_utt(instance->ps, NULL); ^~~~ /usr/local/include/pocketsphinx/pocketsphinx.h:332:5: note: candidate function not viable: requires single argument 'ps', but 2 arguments were provided int ps_start_utt(ps_decoder_t _ps); ^ ../src/Recognizer.cpp:235:16: error: no matching function for call to 'ps_start_utt' int result = ps_start_utt(instance->ps, NULL); ^~~~ /usr/local/include/pocketsphinx/pocketsphinx.h:332:5: note: candidate function not viable: requires single argument 'ps', but 2 arguments were provided int ps_start_utt(ps_decoder_t ps); ^ ../src/Recognizer.cpp:299:21: error: no matching function for call to 'ps_gethyp' const char hyp = ps_get_hyp(instance->ps, &score, &uttid); ^~~~~~ /usr/local/include/pocketsphinx/pocketsphinx.h:408:13: note: candidate function not viable: requires 2 arguments, but 3 were provided char const _ps_get_hyp(ps_decoder_t ps, int32 out_best_score); ^ ../src/Recognizer.cpp:318:21: error: no matching function for call to 'ps_gethyp' const char hyp = ps_get_hyp(data->instance->ps, &score, &uttid); ^~~~~~ /usr/local/include/pocketsphinx/pocketsphinx.h:408:13: note: candidate function not viable: requires 2 arguments, but 3 were provided char const _ps_get_hyp(ps_decoder_t ps, int32 out_best_score); ^ 8 errors generated. make: _* [Release/obj.target/PocketSphinx/src/Recognizer.o] Error 1

nshmyrev commented 9 years ago

You need to set PKG_CONFIG_PATH environment variable to /usr/local/lib/pkgconfig in order to make sure pkg-config sees sphinxbase and pocketsphinx.

nshmyrev commented 9 years ago

It also seems you are trying to build some old source, make sure you are building latest checkout from github.

joshbirk commented 9 years ago

echo $PKG_CONFIG_PATH shows /usr/local/lib/pkgconfig

I really thought this was a fresh clone, but I'll grab again and try to rebuild.

joshbirk commented 9 years ago

Fresh builds of both sphinxbase and pocketsphinx I now get:

CXX(target) Release/obj.target/PocketSphinx/src/Factory.o CXX(target) Release/obj.target/PocketSphinx/src/Recognizer.o ../src/Recognizer.cpp:23:67: error: use of undeclared identifier 'MODELDIR' tpl->Set(String::NewSymbol("modelDirectory"), String::NewSymbol(MODELDIR)); ^ ../src/Recognizer.cpp:73:97: error: use of undeclared identifier 'MODELDIR' String::AsciiValue hmmValue(Default(options->Get(String::NewSymbol("hmm")), String::NewSymbol(MODELDIR "/en-us/en-us"))); ^ ../src/Recognizer.cpp:74:99: error: use of undeclared identifier 'MODELDIR' String::AsciiValue dictValue(Default(options->Get(String::NewSymbol("dict")), String::NewSymbol(MODELDIR "/en-us/cmudict-en-us.dict"))); ^ 3 errors generated.

nshmyrev commented 9 years ago

Are you buildling in xcode? please provide build log for build from scratch.

joshbirk commented 9 years ago

I'm just trying to compile the node module itself from command line. Do you mean the log from node-gyp?

sudo node-gyp rebuild Password: gyp info it worked if it ends with ok gyp info using node-gyp@2.0.1 gyp info using node@0.10.29 | darwin | x64 gyp info spawn python gyp info spawn args [ '/usr/local/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 '/Users/joshua.birk/Projects/node/sphinx/node-pocketsphinx/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/joshua.birk/.node-gyp/0.10.29/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/Users/joshua.birk/.node-gyp/0.10.29', gyp info spawn args '-Dmodule_root_dir=/Users/joshua.birk/Projects/node/sphinx/node-pocketsphinx', 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' ] CXX(target) Release/obj.target/PocketSphinx/src/Factory.o CXX(target) Release/obj.target/PocketSphinx/src/Recognizer.o ../src/Recognizer.cpp:23:67: error: use of undeclared identifier 'MODELDIR' tpl->Set(String::NewSymbol("modelDirectory"), String::NewSymbol(MODELDIR)); ^ ../src/Recognizer.cpp:73:97: error: use of undeclared identifier 'MODELDIR' String::AsciiValue hmmValue(Default(options->Get(String::NewSymbol("hmm")), String::NewSymbol(MODELDIR "/en-us/en-us"))); ^ ../src/Recognizer.cpp:74:99: error: use of undeclared identifier 'MODELDIR' String::AsciiValue dictValue(Default(options->Get(String::NewSymbol("dict")), String::NewSymbol(MODELDIR "/en-us/cmudict-en-us.dict"))); ^ 3 errors generated. make: *\ [Release/obj.target/PocketSphinx/src/Recognizer.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:269:23) gyp ERR! stack at ChildProcess.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12) gyp ERR! System Darwin 13.4.0 gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild" gyp ERR! cwd /Users/joshua.birk/Projects/node/sphinx/node-pocketsphinx gyp ERR! node -v v0.10.29 gyp ERR! node-gyp -v v2.0.1 gyp ERR! not ok

nshmyrev commented 9 years ago

Ok, I've just pushed the fix, please pull and try again.

joshbirk commented 9 years ago

Brilliant, thanks for the quick response. node-gyp gives an OK now.