shimat / opencvsharp

OpenCV wrapper for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

opencvsharp4.9 + ubuntu 20.04 + NET6.0 + Docker Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies

shihuang999 opened this issue · comments

Summary of your issue

my program file info is below:

image

When I Run Code var mat = new Mat(); on Ubuntu20.04 in docker container Throw the exception :

Unhandled exception. 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
at OpenCvSharp.Internal.NativeMethods.redirectError(CvErrorCallback errCallback, IntPtr userdata, IntPtr& prevUserdata)
at OpenCvSharp.Internal.ExceptionHandler.RegisterExceptionCallback()
at OpenCvSharp.Internal.NativeMethods.LoadLibraries(IEnumerable`1 additionalPaths)
at OpenCvSharp.Internal.NativeMethods..cctor()
--- End of inner exception stack trace ---
at OpenCvSharp.Internal.NativeMethods.core_Mat_new1(IntPtr& returnValue)
at OpenCvSharp.Mat..ctor()

image

I Use ldd to check, all is OK,
image

I use LD_DEBUG=Libs to run ,the info is below

image

hope for your response .thanks.

Environment

opencvsharp4.9 + ubuntu 20.04 + NET6.0 + Docker

What did you do when you faced the problem?

Write here

Example code:

   static void Main(string[] args)
   {
       Console.WriteLine("Hello, World!");
       var mat = new Mat();
   }

Output:

paste your output

What did you intend to be?

I solved it I should do "cp libOpenCvSharpExtern.so /usr/lib".