I am developing a Java application that uses speech SDK. Dependancy is added through pom.xml as described on documentation site. Upon code executing I get UnsatisfiedLinkError when trying to create WavStream.
Part of the stack trace:
java.lang.UnsatisfiedLinkError: com.microsoft.cognitiveservices.speech.internal.carbon_javaJNI.swig_module_init()V
at com.microsoft.cognitiveservices.speech.internal.carbon_javaJNI.swig_module_init(Native Method)
at com.microsoft.cognitiveservices.speech.internal.carbon_javaJNI.
at com.microsoft.cognitiveservices.speech.internal.PullAudioInputStreamCallback.
at com.microsoft.cognitiveservices.speech.audio.PullAudioInputStreamCallback$PullAudioInputStreamCallbackAdapter.
at com.microsoft.cognitiveservices.speech.audio.PullAudioInputStreamCallback.
at ai.aiconix.cox.speechtotext.WavStream.
The same thing happens when running on both Ubuntu and Windows.
Latest SDK version is used
Currently, the Speech SDK is only supported on 64bit environments.
Are you sure you are running on a 64bit system and 64bit java vm?
as for java, adding "-d64" should select the correct vm in cases where you have both, 32bit and 64bit environments installed.
please try "java -d64 -version" and make sure the output contains "64-bit VM".
as for ubuntu, which version are you using? We currently only support ubuntu 16.4 and we know that the speech sdk does not work on Ubuntu 18.4 due to incompatible library dependencies.
Sorry for the late reply. When I enter java -version i get the following:
java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
I'm running Windows 10 x64. Also I have installed Microsoft Visual C++ Redistributable for Visual Studio 2017.
For Ubuntu I am using 18.04. In the meantime I found out on a different thread that 18.04 will be supported during December.
Is there a possibility that java 10.0.2 may be an issue?
Yes, it may be possible. Would you be able to try out Java 8 ?
Hi @grale88,
sorry for the delay.
From your question I understand that you were able to run the Quickstart sample successfully, correct?
As for your application, did you create the speechconfig before creating the wav file adapter?
Could you please make sure that you call
SpeechConfig.fromSubscription(KEY, REGION)
(or one of the other from*() functions) at least once before creating your stream class.
The reason is that the speech sdk internally loads the native dll only at the "entry" classes automatically, like SpeechConfig, or Recognizer classes.
please give that a try and see if that helps.
thanks!
Could you please make sure that you call SpeechConfig.fromSubscription(KEY, REGION)
(or one of the other from*() functions) at least once before creating your stream class.
This was a key part. We had creating of AudioConfig and WavStream just before creating SpeechConfig. When we changed the order everything went fine. As a suggestion, if possible, it would be very good if there is some kind of dependency in this case to force the developer to first create SpeechConfig instance.
@fmegen @mahilleb-msft Thank you for the help! 馃憤
Can confirm the same is true when using the SDK for Android as well. Thanks everyone for your insight
I have tried Speech SDK and it worked fine on Ubuntu (16.04 & 18.04) & Windows which are in office premise, however, the same code is not working when tried to run on CentOS 7, RHEL 7 and Ubuntu 16.04 (launched in AWS) and got below exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.microsoft.cognitiveservices.speech.internal.carbon_javaJNI.swig_module_init()V
at com.microsoft.cognitiveservices.speech.internal.carbon_javaJNI.swig_module_init(Native Method)
at com.microsoft.cognitiveservices.speech.internal.carbon_javaJNI.
at com.microsoft.cognitiveservices.speech.SpeechConfig.
at azure.speech.SpeechToText.recognitionWithAudioFile(SpeechToText.java:93)
at azure.speech.SpeechToText.main(SpeechToText.java:69)
All the environments and Java are of 64bit and Speech SDK version is of 1.2.0
Am I missing something here or Speech SDK does not have support for above mentioned OS's. Any help would be appreciable.
@nitinkumar2512 - we currently only support Ubuntu 16.04 and 18.04 as Linux distributions. So, CentOS 7 or RHEL 7 will not currently work. Ubuntu 16.04 on AWS, however, should work .. can you double-check that you've installed the required dependencies (cf. https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstart-java-jre#prerequisites)?
Closing this one .. if it doesn't work in the Ubuntu 16.04 case on AWS after installing the required dependencies, please re-open or open a new issue.
Thanks, Mark
@mahilleb-msft It worked, Thanks for the help.