ubuntu22, net6.0 use OpenCvSharp4 throw exception: Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies.
Environment:
system: ubuntu22 , arm64 libs: OpenCvSharp4 ver 4.8.0.20230708 OpenCvSharp4.Extensions ver 4.8.0.20230708 OpenCvSharp4.runtime.linux-arm ver 4.8.0.20230708 OpenCvSharp4.runtime.linux-arm64.cuda ver 4.8.0.20230708
Example code:
using OpenCvSharp; ... var capture = new VideoCapture(0);
Output:
The type initializer for 'OpenCvSharp.Internal.NativeMethods' threw an exception. Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libOpenCvSharpExtern: cannot open shared object file: No such file or directory
What did you intend to be?
I am getting the same with ubuntu 22 and net 7.0. I think currently there is no support for ubuntu 22?
I'm also experiencing this. Specifically, I'm trying to run this in a Docker container. I've tried in a .NET 6 container (which uses 20) and a .NET 7 container (which uses 22). I do have the base OpenCvSharp4 and OpenCvSharp4.runtime.ubuntu.20.04-x64 packages referenced in my project.
I'm also experiencing this. Specifically, I'm trying to run this in a Docker container. I've tried in a .NET 6 container (which uses 20) and a .NET 7 container (which uses 22). I do have the base OpenCvSharp4 and OpenCvSharp4.runtime.ubuntu.20.04-x64 packages referenced in my project.
Never mind, I was able to get past this by using the docker images located here https://github.com/shimat?tab=packages as my base image.
Hey @cwf689, You can try my self compiled ubuntu22.04 mini version as following, I only compiled core, imgproc, imgcodec:
@sdcb Hey, thank you! Do you have a link to the sources of your "mini" version?
@maaft you're right, I created a build instructions (not source code, but like docs) here: https://github.com/sdcb/opencvsharp-mini-runtime/tree/main
there is a method, my env is ubuntu20.04 x64
- copy
OpenCvSharpExtern.soto your publish dir ldd libOpenCvSharpExtern.so | grep foundto see whether your system has missed some so/dll for me is:
root@ubuntu2004:/home/temp/test8/testubuntucv# ldd *.so* | grep found
liblttng-ust.so.0 => not found
libtesseract.so.4 => not found
libgtk-x11-2.0.so.0 => not found
libgdk-x11-2.0.so.0 => not found
libdc1394.so.22 => not found
libavcodec.so.58 => not found
libavformat.so.58 => not found
libavutil.so.56 => not found
libswscale.so.5 => not found
libIlmImf-2_3.so.24 => not found
- to fix this excecute cmd:
apt-get install libgtk2.0 lttng-ust libtesseract4 libavcodec58 libavformat58 libavutil56 libswscale5 libdc1394-22-dev libopenexr24
then this nuget dll work well. may be you should change the cmd by your real situation
just use what @sdcb says, it works very well in ubuntu-2204 pure system. thanks @sdcb
there is a method, my env is ubuntu20.04 x64
- copy
OpenCvSharpExtern.soto your publish dirldd libOpenCvSharpExtern.so | grep foundto see whether your system has missed some so/dll for me is:root@ubuntu2004:/home/temp/test8/testubuntucv# ldd *.so* | grep found liblttng-ust.so.0 => not found libtesseract.so.4 => not found libgtk-x11-2.0.so.0 => not found libgdk-x11-2.0.so.0 => not found libdc1394.so.22 => not found libavcodec.so.58 => not found libavformat.so.58 => not found libavutil.so.56 => not found libswscale.so.5 => not found libIlmImf-2_3.so.24 => not found
- to fix this excecute cmd:
apt-get install libgtk2.0 lttng-ust libtesseract4 libavcodec58 libavformat58 libavutil56 libswscale5 libdc1394-22-dev libopenexr24then this nuget dll work well. may be you should change the cmd by your real situation @yangbocheng sorry i am getting errors E: Unable to locate package lttng-ust E: Unable to locate package libdc1394-22-dev E: Unable to locate package libopenexr24
Hi @sdcb, are there any pre-built packages of OpenCvSharp4 version 4.10.0.20240616 for Ubuntu 22.04 (mini or full version) available for use?