hecomi / node-julius

Node.js module for voice recognition using Julius
http://d.hatena.ne.jp/hecomi/20121106/1352201767
72 stars 11 forks source link

Compile errors #3

Open dsteinman opened 11 years ago

dsteinman commented 11 years ago

Hi, I'm not sure if you know english -- but I wanted to try your library, and having trouble compiling it.

On Ubuntu Linux, after "make" it results in:

node-gyp rebuild gyp info it worked if it ends with ok gyp info using node-gyp@0.9.5 gyp info using node@0.8.7 | linux | x64 gyp info spawn python gyp info spawn args [ '/home/dstein/node-v0.8.7-linux-x64/lib/node_modules/node-gyp/gyp/gyp', 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/dstein/node_modules/julius/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/home/dstein/node-v0.8.7-linux-x64/lib/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/home/dstein/.node-gyp/0.8.7/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/home/dstein/.node-gyp/0.8.7', gyp info spawn args '-Dmodule_root_dir=/home/dstein/node_modules/julius', gyp info spawn args '--depth=.', 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[1]: Entering directory /home/dstein/node_modules/julius/build' CXX(target) Release/obj.target/julius/src/julius.o In file included from ../src/julius.cpp:4:0: ../src/julius.hpp:99:60: error: ‘nullptr’ was not declared in this scope ../src/julius.cpp: In static member function ‘static v8::Handle<v8::Value> Julius::Start(const v8::Arguments&)’: ../src/julius.cpp:68:39: error: ‘nullptr’ was not declared in this scope ../src/julius.cpp: In constructor ‘Julius::Julius(const std::string&)’: ../src/julius.cpp:161:10: error: ‘nullptr’ was not declared in this scope ../src/julius.cpp: In member function ‘void Julius::make_recog(const std::string&)’: ../src/julius.cpp:192:15: error: ‘nullptr’ was not declared in this scope ../src/julius.cpp:199:16: error: ‘nullptr’ was not declared in this scope ../src/julius.cpp: In member function ‘void Julius::free_recog()’: ../src/julius.cpp:217:16: error: ‘nullptr’ was not declared in this scope ../src/julius.cpp:224:18: error: ‘nullptr’ was not declared in this scope ../src/julius.cpp: In member function ‘void Julius::on_result(Recog*)’: ../src/julius.cpp:276:26: error: ‘nullptr’ was not declared in this scope make[1]: *** [Release/obj.target/julius/src/julius.o] Error 1 make[1]: Leaving directory/home/dstein/node_modules/julius/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/dstein/node-v0.8.7-linux-x64/lib/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:91:17) gyp ERR! stack at Process._handle.onexit (child_process.js:674:10) gyp ERR! System Linux 2.6.38-8-generic gyp ERR! command "node" "/home/dstein/node/bin/node-gyp" "rebuild" gyp ERR! cwd /home/dstein/node_modules/julius gyp ERR! node -v v0.8.7 gyp ERR! node-gyp -v v0.9.5 gyp ERR! not ok make: *\ [all] Error 1

hecomi commented 11 years ago

Hi,

Thank you for the report. It seems that the missing nullptr is the main cause for the build error. nullptr is C++11 new feature and the availability depends on the compiler version. Could you let me know your compiler version?

$ g++ --version

Or, replacing cflags in binding.gyp as following may solve this problem:

            'cflags'         : [
                '<!@(<(libjulius_path)/libjulius-config --cflags)',
                '<!@(<(libsent_path)/libsent-config --cflags)',
                '-std=c++0x',
                '-Dnullptr=0'
            ],
dsteinman commented 11 years ago

Thanks, I've upgraded my version gcc and tried more on both Mac OS and Ubuntu, but still cannot compile for different reasons.

On Ubuntu Linux (12.04) with GCC 4.7.3 I receive this: ... gyp info it worked if it ends with ok gyp info using node-gyp@0.9.5 gyp info using node@0.8.7 | linux | x64 gyp info spawn python gyp info spawn args [ '/home/dstein/node-v0.8.7-linux-x64/lib/node_modules/node-gyp/gyp/gyp', 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/dstein/node_modules/julius/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/home/dstein/node-v0.8.7-linux-x64/lib/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/home/dstein/.node-gyp/0.8.7/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/home/dstein/.node-gyp/0.8.7', gyp info spawn args '-Dmodule_root_dir=/home/dstein/node_modules/julius', gyp info spawn args '--depth=.', 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[1]: Entering directory /home/dstein/node_modules/julius/build' CXX(target) Release/obj.target/julius/src/julius.o SOLINK_MODULE(target) Release/obj.target/julius.node /usr/bin/ld: ../julius-4.2.2/libjulius/libjulius.a(recogmain.o): relocation R_X86_64_32 against.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC ../julius-4.2.2/libjulius/libjulius.a: could not read symbols: Bad value collect2: error: ld returned 1 exit status make[1]: * [Release/obj.target/julius.node] Error 1 make[1]: Leaving directory /home/dstein/node_modules/julius/build' gyp ERR! build error gyp ERR! stack Error:make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/dstein/node-v0.8.7-linux-x64/lib/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:91:17) gyp ERR! stack at Process._handle.onexit (child_process.js:674:10) gyp ERR! System Linux 3.2.0-41-generic gyp ERR! command "node" "/home/dstein/node/bin/node-gyp" "rebuild" gyp ERR! cwd /home/dstein/node_modules/julius gyp ERR! node -v v0.8.7 gyp ERR! node-gyp -v v0.9.5 gyp ERR! not ok make: * [all] Error 1

And on Mac OSX with (macports) GCC 4.8.1 a different error at about the same point: ... node-gyp rebuild gyp info it worked if it ends with ok gyp info using node-gyp@0.9.5 gyp info using node@0.8.2 | darwin | x64 gyp info spawn python gyp info spawn args [ '/Users/dstein/node-0.8.2-x64/lib/node_modules/node-gyp/gyp/gyp', 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/dstein/node_modules/julius/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/dstein/node-0.8.2-x64/lib/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/dstein/.node-gyp/0.8.2/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/Users/dstein/.node-gyp/0.8.2', gyp info spawn args '-Dmodule_root_dir=/Users/dstein/node_modules/julius', gyp info spawn args '--depth=.', 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/julius/src/julius.o c++: error: unrecognized command line option '-Wnewline-eof' make[1]: *\ [Release/obj.target/julius/src/julius.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/Users/dstein/node-0.8.2-x64/lib/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:91:17) gyp ERR! stack at Process._handle.onexit (child_process.js:674:10) gyp ERR! System Darwin 12.2.0 gyp ERR! command "node" "/Users/dstein/node/bin/node-gyp" "rebuild" gyp ERR! cwd /Users/dstein/node_modules/julius gyp ERR! node -v v0.8.2 gyp ERR! node-gyp -v v0.9.5 gyp ERR! not ok

This line make it seem like I still have a gcc problem: c++: error: unrecognized command line option '-Wnewline-eof'

hecomi commented 11 years ago

Sorry for my delayed reply.

Could you try to re-build as below?

$ make clean
$ make
hecomi commented 10 years ago

Hi, could you confirm the status of this issue? If you don't have any problem now, I'll close this issue.

stefancrain commented 10 years ago

I ran into the Error and followed your advice above :

$ make clean
$ make

But I still see the same error :

gyp info it worked if it ends with ok
gyp info using node-gyp@0.12.2
gyp info using node@0.10.24 | linux | x64
gyp info spawn python
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/stefan/Sites/listen/node_modules/julius/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/stefan/.node-gyp/0.10.24/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/stefan/.node-gyp/0.10.24',
gyp info spawn args   '-Dmodule_root_dir=/home/stefan/Sites/listen/node_modules/julius',
gyp info spawn args   '--depth=.',
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[1]: Entering directory `/home/stefan/Sites/listen/node_modules/julius/build'
  CXX(target) Release/obj.target/julius/src/julius.o
  SOLINK_MODULE(target) Release/obj.target/julius.node
/usr/bin/ld: ../julius-4.3/libjulius/libjulius.a(recogmain.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
../julius-4.3/libjulius/libjulius.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[1]: *** [Release/obj.target/julius.node] Error 1
make[1]: Leaving directory `/home/stefan/Sites/listen/node_modules/julius/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:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.11.0-15-generic
gyp ERR! command "node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/stefan/Sites/listen/node_modules/julius
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
make: *** [all] Error 1

My system info :

$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 13.10
Release:    13.10
Codename:   saucy
$ uname -a
Linux senatepc 3.11.0-15-generic #23-Ubuntu SMP Mon Dec 9 18:17:04 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
$ gcc --version
gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
...
$ node -v
v0.10.24
$ julius -help
Julius rev.4.2.2 - based on JuliusLib rev.4.2.2 (fast)  built for x86_64-unknown-linux-gnu

...
hecomi commented 10 years ago

I overlooked the instruction, 'recompile with -fPIC', in your error logs. So, could you try to rebuild with the change of Makefile as below?

berfore (Makefile:8)

cd $(JULIUS) && ./configure --with-mictype=alsa && make

after

cd $(JULIUS) && CFLAGS="-fPIC" ./configure --with-mictype=alsa && make

command

$ make clean
$ make
stefancrain commented 10 years ago

Looks to have built successfully. I should be able to test in the next few days. Thanks!

gyp info it worked if it ends with ok
gyp info using node-gyp@0.12.2
gyp info using node@0.10.25 | linux | x64
gyp http GET http://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz
gyp info spawn python
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/stefan/Sites/listen/node_modules/julius/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/stefan/.node-gyp/0.10.25/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/stefan/.node-gyp/0.10.25',
gyp info spawn args   '-Dmodule_root_dir=/home/stefan/Sites/listen/node_modules/julius',
gyp info spawn args   '--depth=.',
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/stefan/Sites/listen/node_modules/julius/build'
  CXX(target) Release/obj.target/julius/src/julius.o
  SOLINK_MODULE(target) Release/obj.target/julius.node
  SOLINK_MODULE(target) Release/obj.target/julius.node: Finished
  COPY Release/julius.node
make: Leaving directory `/home/stefan/Sites/listen/node_modules/julius/build'
gyp info ok