Unable to load shared library 'Microsoft.CognitiveServices.Speech.csharp.bindings.dll
See original GitHub issueDescribe the bug Deploying an ASP.Net core web application to with Speech SDK to a Linux container, get below error at runtime
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.CognitiveServices.Speech.Internal.carbon_csharpPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'Microsoft.CognitiveServices.Speech.csharp.bindings.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libMicrosoft.CognitiveServices.Speech.csharp.bindings.dll: cannot open shared object file: No such file or directory
at Microsoft.CognitiveServices.Speech.Internal.carbon_csharpPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_carbon_csharp(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
at Microsoft.CognitiveServices.Speech.Internal.carbon_csharpPINVOKE.SWIGExceptionHelper..cctor()
--- End of inner exception stack trace ---
at Microsoft.CognitiveServices.Speech.Internal.carbon_csharpPINVOKE.SWIGExceptionHelper..ctor()
at Microsoft.CognitiveServices.Speech.Internal.carbon_csharpPINVOKE..cctor()
--- End of inner exception stack trace ---
at Microsoft.CognitiveServices.Speech.Internal.carbon_csharpPINVOKE.new_PullAudioInputStreamCallback()
at Microsoft.CognitiveServices.Speech.Internal.PullAudioInputStreamCallback..ctor()
at Microsoft.CognitiveServices.Speech.Audio.PullAudioInputStreamCallbackInternalAdapter..ctor(PullAudioInputStreamCallback callback)
at Microsoft.CognitiveServices.Speech.Audio.PullAudioInputStreamCallback..ctor()
at SignalRChat.Stream.VoiceAudioStream..ctor() in /appsrc/Stream/AudioStream.cs:line 13
at SignalRChat.Hubs.VoiceHub.RegisterAttendeeAsync(String name, String myLanguage, String preferredLanguage) in /appsrc/Hubs/VoiceHub.cs:line 54
at System.Threading.QueueUserWorkItemCallback.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
Dockerfile
# 3.0.0-preview-aspnetcore-runtime
From microsoft/dotnet:3.0.100-preview-sdk
RUN mkdir /appsrc
COPY . /appsrc
WORKDIR /appsrc
RUN echo $(ls)
RUN dotnet restore
RUN dotnet build
EXPOSE 5001
EXPOSE 5000
CMD ["dotnet","run"]
.csproj file
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UserSecretsId>b663f109-4cec-4eb1-a707-0b191626fafa</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<None Remove="APP_DATA\dummy.txt" />
</ItemGroup>
<ItemGroup>
<Content Include="APP_DATA\dummy.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="3.0.0-preview-18579-0056"/>
<PackageReference Include="Microsoft.CognitiveServices.Speech" Version="1.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="3.0.0-preview-18579-0056" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="3.0.0-preview-18579-0056" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Abstractions" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.Extensions.Primitives" Version="3.0.0-preview.18572.1" />
<!-- <PackageReference Include="Microsoft.AspNetCore.Connections.Abstractions" Version="2.2.0" /> -->
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="3.0.0-preview-18579-0056" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.0.0-preview.18572.1" />
</ItemGroup>
<ItemGroup>
<Content Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
check output folder there is not “Microsoft.CognitiveServices.Speech.csharp.bindings.dll” in linux-x64 folder
To Reproduce Steps to reproduce the behavior:
- ssh into a Linux machine (Ubuntu 16.0.6)
- run docker build . -t name:tag
- run docker run -p 5000:5000
Expected behavior Should install package with Microsoft.CognitiveServices.Speech.csharp.bindings.dll
Version of the Cognitive Services Speech SDK 1.2.0
Platform, Operating System, and Programming Language
- OS: [e.g. Windows, Linux, Android, iOS, …] - Ubuntu 16.0.4
- Hardware - x64
- Programming language: ASP.Net core 3.0.0 preview/C#
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Unable to load DLL "Microsoft.CognitiveServices.Speech. ...
Hi. I have a console application that I made in Visual Studio 2022, using C#, .NET Framework 4.8.1, and the Azure Cognitive Services...
Read more >Unable to load DLL "Microsoft.CognitiveServices.Speech. ...
Adding a reference to the file using the Reference Manager, which causes another error to appear: 'A reference to C:\Users\trist\source\repos\ ...
Read more >Problem including a dll that includes Microsoft. ...
I have created .Net Framework Library, but i have a lot of problems when i use at Runtime some object included in Microsoft.CognitiveServices....
Read more >Assembly reference on Microsoft.CognitiveServices. ...
Hello everyone, i'm currently trying to include the Speech to text Cognitive service to my Unity project. I followed the step in this...
Read more >Microsoft.CognitiveServices.Speech 1.31.0
This NuGet package provides native and managed libraries for the Microsoft Cognitive Services Speech SDK. Documentation is available at https://aka.ms/csspeech.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To confirm: the official
mcr.microsoft.com/dotnet/core/aspnet:3.0
doesn’t support Speech SDK. Is there a recommended alternative official image?(
mcr.microsoft.com/dotnet/core/aspnet:3.0-stretch-slim
might be right, but has a preview runtime version? and there’s nosdk:3.0-stretch-slim
)Also tried:
Built on:
mcr.microsoft.com/dotnet/core/sdk:3.0-bionic
Run on:mcr.microsoft.com/dotnet/core/aspnet:3.0-bionic
(“18.04.3 LTS (Bionic Beaver)”)Same:
Unable to load shared library 'libMicrosoft.CognitiveServices.Speech.core.so' or one of its dependencies.
I see under
./runtimes/linux-x64/native
on the container:What’s wrong?
Oh, the exception:
Refers to
liblibMicrosoft.CognitiveServices.Speech.core.so
… ???Update: added this to get it working:
However, the message that it can’t find
liblibMicrosoft.CognitiveServices.Speech.core.so
seems way out?Thanks @kierenj , This worked on the docker image
mcr.microsoft.com/dotnet/core/sdk:3.1-bionic
: