menip / godot_speech_to_text

Speech to text module for Godot 3
https://samuraisigma.github.io/godot-docs/doc/community/tutorials/misc/speech_to_text.html
MIT License
33 stars 2 forks source link

Can't compile godot with this module. #2

Open Sarethh opened 3 years ago

Sarethh commented 3 years ago

I can't build godot 3.2.3 from source with this module because of the errors. Would you mind sending me an already compiled godot exe file with stt module?

germanbv commented 3 years ago

I´ve the same problem, I keep getting: _cl : Command line error D8021 : invalid numeric argument '/Wno-unused-result' Does someone know how to solve this?

Gamemap commented 3 years ago

@germancinho No, but I have the same problem too.

@menip Do you know how to fix this? The Problem is after compiling this:

[Initial build] Compiling ==> modules\godot_speech_to_text\sphinxbase\src\libsphinxbase\feat\feat.c
menip commented 3 years ago

I plan to take a look at this in May.

menip commented 3 years ago

I can't build godot 3.2.3 from source with this module because of the errors. Would you mind sending me an already compiled godot exe file with stt module?

I build without errors, more info needed. Here is a linux build of this module for Godot 3.2.3: https://github.com/menip/godot_speech_to_text/releases/tag/3.2.3

I have built for windows on linux yet, and ran into issues with third party libs, which is not related to this module.


No, but I have the same problem too.

The Problem is after compiling this:

[Initial build] Compiling ==> modules\godot_speech_to_text\sphinxbase\src\libsphinxbase\feat\feat.c

I'm not seeing this when building. Can you specify what the error is?


Finally, there are some changes in the threading API of Godot 3.3 that cause compilation to fail: https://godotengine.org/article/godot-3-3-has-arrived#multithreading. These are straightforward to fix, but I'm getting some linking errors later so can't test.

germanbv commented 3 years ago

as you can see here, it looks like the problem is when compiling windows versions only : https://github.com/SamuraiSigma/speech-to-text/issues/6 For me the error was: Command line error D8021 : invalid numeric argument '/Wno-unused-result'

Gamemap commented 3 years ago

I realized that I read the wrong line. Sorry for that. I have the same problem as germancinho . Here is a picture (with Godot 4.0 master):

Gamemap commented 3 years ago

The same error also occurs with version 3.2 and 3.3.

Gamemap commented 3 years ago

I have tried SamuraiSigma#6 with Godot 3.3 and it worked but now I have this problem:

fatal error C1083: File (Include) can't be opened: "unistd.h": No such file or directory godot-speech-to-text-error2

Gamemap commented 3 years ago

@menip Also several lines had this error "Unknown option "-O3" is ignored." (2nd line in the picture above) . I hope that you can solve this easily.

menip commented 3 years ago

I'm unable to help with MSVC compiler or compiling Godot on Windows, sorry. There are a number of warning that get reported (including Wno-unused-result), but they are warning with g++, not errors. I could potentially look at them in the future, but it is not my priority at this point.

@Gamemap if you can solve your compiling with 3.2, feel free to open a PR.

Gamemap commented 3 years ago

Unfortunately I don't know how to program something like this (GDscript is my first programming language). I can try to learn it, but that can take a lot of time.

Maybe I can find solutions to this problem in forums, then I will open a PR.

Gamemap commented 3 years ago

I have found two attempts to create or replace the unistd.h file for windows. Maybe this helps.

  1. Put these files into the MSVC include folder.
https://stackoverflow.com/questions/341817/is-there-a-replacement-for-unistd-h-for-windows-visual-c unistd.h for windows
https://gist.github.com/ashelly/7776712 getop for windows
  1. Change #include <unistd.h> to #include <io.h> ("modules\godot_speech_to_text\sphinxbase\src\libsphinxbase\util\pio.c", and "modules\godot_speech_to_text\sphinxbase\src\libsphinxbase\util\cmd_In.c")

With both solutions I'm getting this error:

[Initial build] Compiling ==> modules\godot_speech_to_text\stt_runner.cpp
stt_runner.cpp
modules\godot_speech_to_text\stt_runner.cpp(43): error C2131: Expression did not evaluate to a constant.
modules\godot_speech_to_text\stt_runner.cpp(43): note: The error was caused by a read access to a variable outside its lifetime.
modules\godot_speech_to_text\stt_runner.cpp(43): note: see use of "this".
scons: *** [modules\godot_speech_to_text\stt_runner.windows.tools.64.obj] Error 2
scons: building terminated because of errors.

I don't know if this is a good alternative. Gamemap

IvailoBurov commented 3 years ago

I tried to compile it with VC and MinGW (gcc) for windows, however in both cases error appears related Thread. Here is output with gcc:

b"modules\\godot_speech_to_text\\stt_runner.cpp: In member function 'STTError::Error STTRunner::start()':\nmodules\\godot_speech_to_text\\stt_runner.cpp:19:24: error: 'create' is not a member of 'Thread'\n   19 |  recognition = Thread::create(STTRunner::_thread_recognize, this);\n      |                        ^~~~~~\nmodules\\godot_speech_to_text\\stt_runner.cpp: In member function 'void STTRunner::stop()':\nmodules\\godot_speech_to_text\\stt_runner.cpp:31:37: error: no matching function for call to 'Thread::wait_to_finish(Thread*&)'\n   31 |   Thread::wait_to_finish(recognition);\n      |                                     ^\nIn file included from ./core/io/resource_loader.h:34,\n                 from ./scene/resources/shader.h:34,\n                 from ./scene/resources/material.h:36,\n                 from ./scene/resources/mesh.h:37,\n                 from ./scene/main/scene_tree.h:38,\n                 from ./scene/main/node.h:40,\n                 from modules\\godot_speech_to_text\\stt_runner.h:4,\n                 from modules\\godot_speech_to_text\\stt_runner.cpp:1:\n./core/os/thread.h:98:7: note: candidate: 'void Thread::wait_to_finish()'\n   98 |  void wait_to_finish();\n      |       ^~~~~~~~~~~~~~\n./core/os/thread.h:98:7: note:   candidate expects 0 arguments, 1 provided\nmodules\\godot_speech_to_text\\stt_runner.cpp: In destructor 'virtual STTRunner::~STTRunner()':\nmodules\\godot_speech_to_text\\stt_runner.cpp:189:37: error: no matching function for call to 'Thread::wait_to_finish(Thread*&)'\n  189 |   Thread::wait_to_finish(recognition);\n      |                                     ^\nIn file included from ./core/io/resource_loader.h:34,\n                 from ./scene/resources/shader.h:34,\n                 from ./scene/resources/material.h:36,\n                 from ./scene/resources/mesh.h:37,\n                 from ./scene/main/scene_tree.h:38,\n                 from ./scene/main/node.h:40,\n                 from modules\\godot_speech_to_text\\stt_runner.h:4,\n                 from modules\\godot_speech_to_text\\stt_runner.cpp:1:\n./core/os/thread.h:98:7: note: candidate: 'void Thread::wait_to_finish()'\n   98 |  void wait_to_finish();\n      |       ^~~~~~~~~~~~~~\n./core/os/thread.h:98:7: note:   candidate expects 0 arguments, 1 provided\n"
=====
Compiling ==> thirdparty\mbedtls\library\cipher.c
[ 27%] Compiling ==> thirdparty\mbedtls\library\cipher_wrap.c
[ 27%] Compiling ==> thirdparty\mbedtls\library\cmac.c
[ 27%] Compiling ==> thirdparty\mbedtls\library\ctr_drbg.c
[ 27%] Compiling ==> thirdparty\mbedtls\library\debug.c
[ 27%] scons: *** [modules\godot_speech_to_text\stt_runner.windows.opt.tools.64.o] Error 1
Compiling ==> thirdparty\mbedtls\library\des.c
Ranlib Library         ==> main\libmain.windows.opt.tools.64.a
scons: building terminated because of errors.
Gamemap commented 3 years ago

Here is the output with VC:

[Initial build] Compile ==> modules\godot_speech_to_text\stt_runner.cpp
stt_runner.cpp
modules\godot_speech_to_text\stt_runner.cpp(19): Error C2039: "create" is not a member of "thread".
D:\Programs\CompileGodot\3. test\godot-3.3\core/os/thread.h(43): Note: See declaration of "Thread".
modules\godot_speech_to_text\stt_runner.cpp(19): Error C3861: "create": Identifier not found.
modules\godot_speech_to_text\stt_runner.cpp(31): error C2660: "Thread::wait_to_finish": function does not accept 1 arguments
D:\Programs\CompileGodot\3. test\godot-3.3\core/os/thread.h(98): Note: See declaration of "Thread::wait_to_finish".
modules\godot_speech_to_text\stt_runner.cpp(190): Error C2660: "Thread::wait_to_finish": Function does not accept 1 arguments
D:\Programs\CompileGodot\3. test\godot-3.3\core/os/thread.h(98): Note: See declaration of "Thread::wait_to_finish".
scons: *** [modules\godot_speech_to_text\stt_runner.windows.tools.32.obj] error 2
scons: The build was aborted due to errors.
menip commented 3 years ago

@IvailoBurov @Gamemap Like mentioned here: https://github.com/menip/godot_speech_to_text/issues/2#issuecomment-835557906 and here: https://github.com/menip/godot_speech_to_text/issues/2#issuecomment-834917497 this library is not yet compatible with 3.3 due to the Threading API changes. Please try compiling against 3.2.3-stable.

Gamemap commented 3 years ago

With 3.2.3-stable, compiling works except for the end.

modules.windows.tools.32.lib(pio.windows.tools.32.obj) : error LNK2019: Reference to unresolved external symbol "_popen" in function "_fopen_comp".
modules.windows.tools.32.lib(pio.windows.tools.32.obj) : error LNK2019: Reference to unresolved external symbol "_sleep" in function "_stat_retry".
bin\godot.windows.tools.32.exe : fatal error LNK1120: 2 unresolved externals
scons: *** [bin\godot.windows.tools.32.exe] Error 1120
scons: building terminated because of errors.

@menip I had forgotten the threading API and didn't know the location for the 3.2.3 stable source code (now I found it) Sorry for that!

I'm sorry that I can only send the error messages because I don't know how to write something like that, but if I can help better, please write. I will try to do my best.

Gamemap

menip commented 3 years ago

@Gamemap don't worry about it, the error messages have been helpful.


I was finally able to figure out how to compile for Windows, and produced a Godot 3.2.3 binary with SST module builtin. Could you try it and let me know if it's working? After this is solved I can take a look at the Threading changes.

Linux and Windows releases here: https://github.com/menip/godot_speech_to_text/releases/tag/3.2.3

EDIT: also tagging @Sarethh as they requested an exe

germanbv commented 3 years ago

oh thank you! I've tested and it seems to be working at first sight... I haven't tested the SST module though....

Gamemap commented 3 years ago

I think it works, but I noticed the following errors:

  1. You can't set the STTConfig files via the filemanager, because the star and dot in front of the filename is missing. godot-speech-to-text-dot1 godot-speech-to-text-dot2

  2. In STTRunner node there is a field for queue but you can't use it. When clicking STTQueue this error appears: godot-speech-to-text-error4

3. STTRunner.get_queue().get() dosen't work. .get() wants to have a string argument and does not output the recorded word. EDIT: With .next() can I get the recorded word.

  1. Special characters like ä, ö, ü and ß (in German) are skipped or have this: ° spaß -> spa゚ glück -> glck

  2. If you stop the program with the editor (F5), the user://stt files are not deleted. If you close it with the X these files aren't deleted. Is this intended? godot-speech-to-text-error5

Is it possible to get correct capital letters? Edit: Yes it is possible to change the capitalization. You only have to change the words in the .dict and the .kws file. (They have to be the same.)

menip commented 3 years ago

@Gamemap please open a separate issue, this one is for dealing with compiling issues.

menip commented 1 year ago

I've updated master to compile with Godot 3.5, and uploaded linux and windows binaries

I've tested on Linux, appears to work. Let me know if you still run into compile issues with Godot 3.5.