Skip to content

Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies. #701

@thebpmgroup

Description

@thebpmgroup

Summary of your issue

Using VSCode and dot net core 2.2 following the instructions 👍

dotnet new console -n ConsoleApp01
cd ConsoleApp01
dotnet add package OpenCvSharp4
dotnet add package OpenCvSharp4.runtime.ubuntu.18.04-x64

-- edit Program.cs ---

dotnet run

When I add the following code

using System;
using OpenCvSharp;

namespace ConsoleApp01
{
class Program
{
static void Main(string[] args)
{
var srcImage = new Mat(@"/somepathtoafile.jpg");
Cv2.ImShow("Source", srcImage);
Cv2.WaitKey(1); // do events
}
}
}

Environment

Ubuntu 18.04 Desktop 64bit

What did you do when you faced the problem?

Just tried to run the program.

Output:

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

Unhandled Exception: System.TypeInitializationException: The type initializer for 'OpenCvSharp.NativeMethods' threw an exception. ---> OpenCvSharp.OpenCvSharpException: 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 ---> 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.NativeMethods.core_Mat_sizeof()
at OpenCvSharp.NativeMethods.TryPInvoke() in C:\projects\opencvsharp\src\OpenCvSharp\PInvoke\NativeMethods.cs:line 136
--- End of inner exception stack trace ---
at OpenCvSharp.NativeMethods.TryPInvoke() in C:\projects\opencvsharp\src\OpenCvSharp\PInvoke\NativeMethods.cs:line 145
at OpenCvSharp.NativeMethods..cctor() in C:\projects\opencvsharp\src\OpenCvSharp\PInvoke\NativeMethods.cs:line 60
--- End of inner exception stack trace ---
at OpenCvSharp.NativeMethods.imgcodecs_imread(String filename, Int32 flags)
at OpenCvSharp.Mat..ctor(String fileName, ImreadModes flags) in C:\projects\opencvsharp\src\OpenCvSharp\Modules\core\Mat\Mat.cs:line 78
at ConsoleApp01.Program.Main(String[] args) in /home/suityou01/installation/test/ConsoleApp01/Program.cs:line 10

What did you intend to be?

To compile and run ok

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions