Azure-Samples / cognitive-services-speech-sdk

Sample code for the Microsoft Cognitive Services Speech SDK
MIT License
2.87k stars 1.85k forks source link

java.lang.UnsatisfiedLinkError: com.microsoft.cognitiveservices.speech.AutoDetectSourceLanguageConfig.fromLanguages #863

Closed sebzimmermann closed 3 years ago

sebzimmermann commented 3 years ago

Describe the bug I'm trying to use the STT functionality in an external jar on a linux server (ubuntu 16.04). The jar is running as a daemon (jsvc). When the code runs, an unsatisfiedlinkerror exception occurs.

Exception in thread "Thread-78" java.lang.UnsatisfiedLinkError: com.microsoft.cognitiveservices.speech.AutoDetectSourceLanguageConfig.fromLanguages(Lcom/microsoft/cognitiveservices/speech/util/IntRef;Ljava/lang/String;)J

I'm loading the .so files with System.load:

System.load(ConfigProperties.getInstance().getBinariesDir() + "libMicrosoft.CognitiveServices.Speech.core.so");
System.load(ConfigProperties.getInstance().getBinariesDir() + "libpma.so");
System.load(ConfigProperties.getInstance().getBinariesDir() + "libunimic_runtime.so");
System.load(ConfigProperties.getInstance().getBinariesDir() + "libMicrosoft.CognitiveServices.Speech.extension.pma.so");
System.load(ConfigProperties.getInstance().getBinariesDir() + "libMicrosoft.CognitiveServices.Speech.extension.codec.so");
System.load(ConfigProperties.getInstance().getBinariesDir() + "libMicrosoft.CognitiveServices.Speech.extension.kws.so");

The files are loaded properly.

The code runs fine within the IDE, but not on the server. Any files I'm missing which should be loaded?

Version of the Cognitive Services Speech SDK 1.14.0

Platform, Operating System, and Programming Language

Additional context

Exception in thread "Thread-78" java.lang.UnsatisfiedLinkError: com.microsoft.cognitiveservices.speech.AutoDetectSourceLanguageConfig.fromLanguages(Lcom/microsoft/cognitiveservices/speech/util/IntRef;Ljava/lang/String;)J
        at com.microsoft.cognitiveservices.speech.AutoDetectSourceLanguageConfig.fromLanguages(Native Method)
        at com.microsoft.cognitiveservices.speech.AutoDetectSourceLanguageConfig.fromLanguages(AutoDetectSourceLanguageConfig.java:65)
        at scs.jobs.tasks.create.stt.microsoft.SpeechToTextMicrosoft.startTranscribeJob(SpeechToTextMicrosoft.java:59)
        at scs.jobs.tasks.TranscribeTask.performMicrosoftTranscribeJob(TranscribeTask.java:141)
        at scs.jobs.tasks.TranscribeTask.performTranscribeJob(TranscribeTask.java:110)
        at scs.jobs.tasks.TranscribeTask.run(TranscribeTask.java:73)
        at java.lang.Thread.run(Thread.java:748)
amitkumarshukla commented 3 years ago

@sebzimmermann Thanks a lot for raising this issue. I am looking at this and will get back to you very soon.

jhakulin commented 3 years ago

@sebzimmermann When you say "I'm loading the .so files with System.load()", so you are explicitly loading those in your app code? Does also libMicrosoft.CognitiveServices.Speech.java.bindings.so get loaded?

sebzimmermann commented 3 years ago

Yes @jhakulin. I can't find a file called libMicrosoft.CognitiveServices.Speech.java.bindings.so in the sdsdk-jre.zip - so it not loaded. Is this file not a part of the SDK? Where can I find this file?

jhakulin commented 3 years ago

@sebzimmermann You seems to use Speech Devices SDK, where the .jar delivery is in separate package (sdsdk-jre.zip) and there seems to be an issue. I'll make sure that package will be fixed.

To get all files, please download your jre package from the maven repository described in the link below and use the latest version 1.14.0 of Speech SDK. https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstarts/setup-platform?tabs=dotnet%2Clinux%2Cjre%2Cbrowser&pivots=programming-language-java

sebzimmermann commented 3 years ago

The code works after adding libMicrosoft.CognitiveServices.Speech.java.bindings.so to the System.load.