Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I have used the OpenCvSharp library in my .net core 3.0 application when running this application in the windows environment, the application is running without any issues. When the same application is deployed and hosted in the docker running in ubuntu 18.04 the following exception is occurred:
System.DllNotFoundException: Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies.
I have installed the following packages (nuget) which are required for running the OpenCvSharp4 in the ubuntu environment:
OpenCvSharp4
OpenCvSharp4.runtime.ubuntu.18.04-x64
When Checked the dependency of the libOpenCvSharpExtern.so library using the following command:
ldd libOpenCvSharpExtern.so
Some of the dependency assemblies was missing, so I have installed all the necessary packages which is mentioned in the below GitHub thread which reports the same exact issue:
https://github.com/shimat/opencvsharp/issues/889
But still the some of the dependencies are found to be missing and those assemblies name are given below:
libavcodec.so.57 => not found
libavformat.so.57 => not found
libavutil.so.55 => not found
libswscale.so.4 => not found
libjpeg.so.8 => not found
I have also tried installing the following packages “libjpeg62-turbo-dev” and “libavcodec-extra57” for fixing the ‘not found’ assemblies. But still the issue occurred.
Any suggestion on how to fix this issue would be appreciated.
–
We had the same issue. After a lot of experimentation we got it working with the following setup (Docker):
csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net472</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenCvSharp4" Version="4.4.0.20200725" />
<PackageReference Include="OpenCvSharp4.runtime.debian.10-amd64" Version="4.3.0.20200424" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.4.0.20200725" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
</ItemGroup>
</Project>
dockerfile
[...]
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
[...]
RUN apt-get update && apt-get install -y \
apt-utils \
libgdiplus \
libc6-dev \
libgtk2.0-dev \
libtbb-dev \
libatlas-base-dev \
libvorbis-dev \
libxvidcore-dev \
libopencore-amrnb-dev \
libopencore-amrwb-dev \
libavresample-dev \
x264 \
v4l-utils \
libwebp-dev \
tesseract-ocr \
libtesseract-dev \
libleptonica-dev \
libtiff-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libdc1394-22-dev \
libxine2-dev \
libv4l-dev
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
[...]
Unfortunately, I'm not entirely sure which of the many apt packages did the trick, I'm just happy it works now ;)
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.