shimat / opencvsharp

OpenCV wrapper for .NET
Apache License 2.0
5.22k stars 1.13k forks source link

RaspberryPi 4b. Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies #1621

Closed vhytyk closed 7 months ago

vhytyk commented 8 months ago

Summary of your issue

I'm trying to run simple console app on Raspberry PI 4b, that uses OpencvSharp4 libs w/ dontet 6. Code is simple: Console.WriteLine(OpenCvSharp.Cv2.GetVersionString()) But it's failing with error:

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

Environment

Raspberry pi 4b. Linux raspberrypi 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux

What did you do when you faced the problem?

Tried this package: OpenCvSharp4.runtime.linux-arm Didn't help. Tried copy libOpenCvSharpExtern.so from /runtimes folder to dotnet output. Didn't help.

Example code:

Console.WriteLine(OpenCvSharp.Cv2.GetVersionString())

Output:

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_getVersionString(Byte* buf, Int32 maxLength)
   at OpenCvSharp.Cv2.GetVersionString()
   at Program.<Main>$(String[] args) in /home/pi/opencv_test/Program.cs:line 3

What did you intend to be?

RemyEE commented 2 months ago

How did you solve your problem?

behroozbc commented 1 week ago

how you fix this problem?