Unable to load shared library OpenCvSharpExtern, Ubuntu 22.04
See original GitHub issueSummary of your issue
I’m trying OpenCvSharp on Ubuntu 22.04 and I’m getting following error
System.DllNotFoundException : 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
I’m referencing OpenCvSharp4.runtime.ubuntu.18.04-x64
package.
Environment
Ubuntu 22.04
What did you do when you faced the problem?
libOpenCvSharpExtern
is located in build folder under ./bin/Debug/net6.0/runtimes/ubuntu.18.04-x64/native/
instead ./bin/Debug/net6.0/
. So running ldd libOpenCvSharpExtern.so
returns shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Then I copied libOpenCvSharpExtern.so
to ./bin/Debug/net6.0/
and try to run application from there resulting in same : System.DllNotFoundException : 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
exception.
Then I run ldd libOpenCvSharpExtern.so
again resulting in :
❯ ldd libOpenCvSharpExtern.so
linux-vdso.so.1 (0x00007ffc407f8000)
libtesseract.so.4 => /lib/x86_64-linux-gnu/libtesseract.so.4 (0x00007f5be46f6000)
libgtk-x11-2.0.so.0 => /lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0 (0x00007f5be427f000)
libgdk-x11-2.0.so.0 => /lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0 (0x00007f5be89f9000)
libcairo.so.2 => /lib/x86_64-linux-gnu/libcairo.so.2 (0x00007f5be4157000)
libgdk_pixbuf-2.0.so.0 => /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007f5be89c9000)
libgobject-2.0.so.0 => /lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f5be8967000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f5be401d000)
libdc1394.so.22 => not found
libavcodec.so.57 => not found
libavformat.so.57 => not found
libavutil.so.55 => not found
libswscale.so.4 => not found
libjpeg.so.8 => /lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f5be3f9c000)
......
So, I have few questions like:
- can we have proper Ubuntu 22.04 nuget package ?
- list of required Ubuntu packages that we need to install before using OpenCvSharp ?
- fix deploy script so we have
libOpenCvSharpExtern.so
in proper location ?
I would like to use OpenCvSharp but this is blocking me for using it.
Example code:
byte[] image = new ();// not important
Mat src = Cv2.ImDecode( image, ImreadModes.Color );
Output:
Error Message:
System.TypeInitializationException : The type initializer for 'OpenCvSharp.Internal.NativeMethods' threw an exception.
----> System.DllNotFoundException : 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?
Compile and run.
Issue Analytics
- State:
- Created a year ago
- Comments:16 (4 by maintainers)
Top GitHub Comments
Here’s the code @dsoronda
It’s just taking the existing Dockerfile and adding a step to build a NuGet package.
package.zip
One can then create the package by:
However, concerning Jammy.Dockerfile, I’m just guessing the needed native deps. But the tests are passing and the OpenCV functionality I need in my project seems to work as well.
@Evelios How far did you get?
I’ve made two NuGet packages for internal use that contain binaries for Ubuntu 20.04 and Ubuntu 22.04. I’m now working on dockerizing the creation of both. I could then turn that into a PR, would you be interested?