Open LeSplooch opened 4 years ago
Have you added the directory with deepspeech.lib to your path?
I didn't get any file called deepspeech.lib with the tar.gz file you mentioned on your README and the native_client version for Windows, and the native_client is added to my path.
Hmm I see, that's a valid question. There is a .lib file in the windows native client but it's called differently.
Indeed, there is a file called libdeepspeech.so.if.lib
.
@LeSplooch if you clone this repo, and change the "deepspeech" in sys/build.rs to deepspeech.so, does it work then?
@LeSplooch if you clone this repo, and change the "deepspeech" in sys/build.rs to deepspeech.so, does it work then?
Oh sorry I just saw your post, I'll try this asap and let you know about the result.
@LeSplooch don't worry I got the idea just now and was already afraid you dismissed deepspeech completely. With https://github.com/rust-lang/rust/issues/58713 we might make the usage of .lib files obsolete.
Also if my suggestion doesnt work, try changing it to deepspeech.so.if
.
I was about to do it but I've never worked with folder crates yet, so I'd need a little help in order to import that into my code. I just cargo add
everything most of the time or link the git in Cargo.toml.
@LeSplooch the docs for path dependencies are here: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-path-dependencies
You could clone deepspeech-rs and then point to the local clone via path instead of the crates.io version.
I'm really sorry for the delayed answer. So deepspeech-rs
is cloned and linked in Cargo.toml
and ./deepspeech-rs/sys/build.rs
has been modified to this :
fn main() {
println!("cargo:rustc-link-lib=deepspeech.so");
}
But now I have a problem : apparently, Model.enable_decoder_with_lm()
doesn't exist anymore, and I don't know what to replace it with.
It's not needed any more, see 987669529c5b1aea8f5a761349a15a0dac2bd50b
I still have a link.exe fatal error message with both deepspeech.so
and deepspeech.so.if
.
= note: LINK : fatal error LNK1181: cannot open input file 'deepspeech.so.lib'
= note: LINK : fatal error LNK1181: cannot open input file 'deepspeech.so.if.lib'
That issue is because the linker can't find those files. But they exist, you just have to tell the directory the downloaded precompiled library lies inside. Have you added it to the PATH
environment variable?
The absolute path to native_client
is among my Path
env vars.
I'm also having this problem.
I guess I should add something a little more helpful...
I've changed build.rs
locally to exactly the name of the file I downloaded:
#[cfg(target_os = "windows")]
fn main() {
println!("cargo:rustc-link-lib=libdeepspeech.so.if");
}
It still doesn't work, even though the folder is in my path. where libdeepspeech.so.if.lib
succeeds (I'm using Cygwin).
EDIT: libdeepspeech.so
like you suggested also doesn't work.
I got it!
My local copy of build.rs
now looks like this:
// It's bugged on windows >:(
#[cfg(target_os = "windows")]
fn main() {
println!(r"cargo:rustc-link-search=C:\deepspeech");
println!("cargo:rustc-link-lib=libdeepspeech.so.if");
}
#[cfg(not(target_os = "windows"))]
fn main() {
println!("cargo:rustc-link-lib=deepspeech");
}
I also have put the folder I downloaded where I marked above. (I had it deeper in my file tree, but my username has a space in it and rustc
was having a hard time with it.) I also added that folder to PATH
.
Yay! Hope this helps @LeSplooch!
@gamma-delta Awesome! Can you put this into a PR?
Maybe! I'm not the best at Github.
Probably what I'll do is set it up with an environment variable, and include in the install instructions to set it to wherever you put the files. Then build.rs
just queries the variable.
For the record, if you want to tell the linker on Windows where you have libraries installed, you need to modify LIB
, not PATH
. LIB
is used to find libraries (foo.lib
) at link time, PATH
is used to find binaries (foo.dll
/foo.exe
) at run time.
@retep998 If I understand you correctly, I should create a value containing a comma seperated array with the path to the folder where my deepspeech.lib
file is, and assign it to a new variable called LIB
, is that it?
I have no LIB
variable at the moment.
I tried it and now I have another error, but I think it's a good sign, it looks like the libraries have been found but it can't handle them for some reason (I'm not familiar with linker errors).
Here is the output :
= note: libdeepspeech-596af0fd2763f984.rlib(deepspeech-596af0fd2763f984.deepspeech.6i45m1o7-cgu.2.rcgu.o) : error LNK2019: unresolved external symbol DS_EnableExternalScorer referenced in function _ZN10deepspeech5Model22enable_external_scorer17h9fc6471303cc31e3E
libdeepspeech-596af0fd2763f984.rlib(deepspeech-596af0fd2763f984.deepspeech.6i45m1o7-cgu.2.rcgu.o) : error LNK2019: unresolved external symbol DS_DisableExternalScorer referenced in function _ZN10deepspeech5Model23disable_external_scorer17h3721a9ad438e6571E
libdeepspeech-596af0fd2763f984.rlib(deepspeech-596af0fd2763f984.deepspeech.6i45m1o7-cgu.2.rcgu.o) : error LNK2019: unresolved external symbol DS_GetModelBeamWidth referenced in function
_ZN10deepspeech5Model20get_model_beam_width17ha127ef1639900027E
libdeepspeech-596af0fd2763f984.rlib(deepspeech-596af0fd2763f984.deepspeech.6i45m1o7-cgu.2.rcgu.o) : error LNK2019: unresolved external symbol DS_SetModelBeamWidth referenced in function
_ZN10deepspeech5Model20set_model_beam_width17h3cfba3f016bf445fE
libdeepspeech-596af0fd2763f984.rlib(deepspeech-596af0fd2763f984.deepspeech.6i45m1o7-cgu.2.rcgu.o) : error LNK2019: unresolved external symbol DS_SetScorerAlphaBeta referenced in function _ZN10deepspeech5Model21set_scorer_alpha_beta17hf22408dd472bc89eE
libdeepspeech-596af0fd2763f984.rlib(deepspeech-596af0fd2763f984.deepspeech.6i45m1o7-cgu.2.rcgu.o) : error LNK2019: unresolved external symbol DS_Version referenced in function _ZN10deepspeech18deepspeech_version17ha05bd2d6a0180a9cE
F:\Rust Test\cpal_test\target\release\deps\cpal_test.exe : fatal error LNK1120: 6 unresolved externals
error: aborting due to previous error; 6 warnings emitted
I followed @gamma-delta's instructions but now I'm getting error: process didn't exit successfully: `target\release\examples\client.exe G:\models G:\voice.ogg` (exit code: 0xc0000135, STATUS_DLL_NOT_FOUND)
Summary of what I did:
vendored
directory in my project where I cloned https://github.com/RustAudio/deepspeech-rs/
at commit f94b98d429bdac30b9b9aaa048946537b6ebd575
(it was the last successfully building one)vendored/deepspeech-win
vendored/deepspeech-rs/sys/build.rs
according to this comment https://github.com/RustAudio/deepspeech-rs/issues/25#issuecomment-633173762 replacing the directory with vendored/deepspeech-win
At this point it compiles fine now that it can find the libdeepspeech.so.if
file. However when I try to run any of the examples or tests or the binary in general I see that STATUS_DLL_NOT_FOUND
error.
What's confusing me the most is I thought this would be statically linking the library so why is it looking for a DLL in the first place?
@teovoinea
I have met this issue like you, have you resolve this problem?
oh, i have added set rustc-link-search= C:\deepspeech before I run cargo run --release --example client
example/client can be run successfully.
but In my scenario, I got another error:
Data loss: Can't parse .\models\deepspeech-0.9.3-models.tflite as binary proto
Hello. After following the steps in your "Quickstart" section of the README.md, I tried compiling a crate using deepspeech-rs v0.6.1 on Windows 10, and I'm having the following error :
It looks like the compiler can't find a file but I don't know how to get it.
I'm really sorry if it's not the right place to talk about this but I can't find help anywhere else.