question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to load DLL 'OpenCvSharpExtern' - RaspberryPi 3, Ubuntu, .NET Core

See original GitHub issue

Hi!

I’m trying to run API which uses OpenCVSharp3-AnyCPU (3.2.0.20170210-beta). I run it on a Raspberry Pi 3 with .NET Core (1.2.0-beta-001291-00) and Raspbian GNU/Linux 8.0 (jessie) on the board.

When I try to start my app with dotnet My.API.dll, I get error (actually it invokes ctor of CascadeClassifier):

Unable to load DLL 'OpenCvSharpExtern': The specified module could not be found.
 (Exception from HRESULT: 0x8007007E)
*** An exception has occurred because of P/Invoke. ***
Please check the following:
(1) OpenCV's DLL files exist in the same directory as the executable file.
(2) Visual C++ Redistributable Package has been installed.
(3) The target platform(x86/x64) of OpenCV's DLL files and OpenCvSharp is the same as your project's.

System.DllNotFoundException: Unable to load DLL 'OpenCvSharpExtern': The specified module could not be found.
 (Exception from HRESULT: 0x8007007E)
   at OpenCvSharp.NativeMethods.core_Mat_sizeof()
   at OpenCvSharp.NativeMethods.TryPInvoke()

My folder contains those items:

CoreCompat.System.Drawing.dll
haarcascade_frontalcatface_extended.xml
haarcascade_frontalface_default.xml
My.API.dll
Microsoft.AspNetCore.Hosting.Abstractions.dll
Microsoft.AspNetCore.Hosting.dll
Microsoft.AspNetCore.Hosting.Server.Abstractions.dll
Microsoft.AspNetCore.Http.Abstractions.dll
Microsoft.AspNetCore.Http.dll
Microsoft.AspNetCore.Http.Extensions.dll
Microsoft.AspNetCore.Http.Features.dll
Microsoft.AspNetCore.Owin.dll
Microsoft.AspNetCore.Server.Kestrel.dll
Microsoft.AspNetCore.WebUtilities.dll
Microsoft.DotNet.InternalAbstractions.dll
Microsoft.Extensions.Configuration.Abstractions.dll
Microsoft.Extensions.Configuration.dll
Microsoft.Extensions.Configuration.EnvironmentVariables.dll
Microsoft.Extensions.DependencyInjection.Abstractions.dll
Microsoft.Extensions.DependencyInjection.dll
Microsoft.Extensions.DependencyModel.dll
Microsoft.Extensions.FileProviders.Abstractions.dll
Microsoft.Extensions.FileProviders.Physical.dll
Microsoft.Extensions.FileSystemGlobbing.dll
Microsoft.Extensions.Logging.Abstractions.dll
Microsoft.Extensions.Logging.dll
Microsoft.Extensions.ObjectPool.dll
Microsoft.Extensions.Options.dll
Microsoft.Extensions.PlatformAbstractions.dll
Microsoft.Extensions.Primitives.dll
Microsoft.Net.Http.Headers.dll
Nancy.dll
Newtonsoft.Json.dll
opencv_ffmpeg320_64.dll
OpenCvSharp.Blob.dll
OpenCvSharp.dll
OpenCvSharp.dll.config
OpenCvSharpExtern.dll
refs
System.Collections.NonGeneric.dll
System.Collections.Specialized.dll
System.ComponentModel.Primitives.dll
System.ComponentModel.TypeConverter.dll
System.Data.Common.dll
System.Diagnostics.Contracts.dll
System.Drawing.Primitives.dll
System.Linq.dll
System.Net.WebSockets.dll
System.Runtime.Serialization.Primitives.dll
System.Text.Encodings.Web.dll
System.Xml.XmlSerializer.dll
web.config
x64
x86

I’ve tried to use dlls mapping, so I’ve created OpenCvSharp.dll.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <dllmap os="!windows" dll="opencv_core2410" target="libopencv_core.so.2.4.10" />
  <dllmap os="!windows" dll="opencv_imgproc2410" target="libopencv_imgproc.so.2.4.10" />
</configuration>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
shimatcommented, Feb 17, 2017

The OpenCvSharpExtern.dll that I released may work only on x86/x64 Windows 😢 You have to build OpenCvSharpExtern.dll for your Linux platform. Please get the OpenCvSharp source code files and use cmake.

cmake src
1reaction
matjanoscommented, Feb 17, 2017

Thanks a lot for quick reply. I think that it would be useful to prepare a CI process for Linux machines as well. Cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenCVSharp: Unable to load DLL 'OpenCvSharpExtern'
OpenCvSharpExtern.dll requires mfplat.dll that is part of the Media Feature Pack. Windows 'N' editions do not include this by default.
Read more >
Docker multi-architecture, .NET 6.0 and OpenCVSharp
The objective of this post is to build a reusable multi-architecture Docker image containing native OpenCVSharpExtern library as well as ...
Read more >
opencvsharp
MacOS Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies.
Read more >
Unable to load DLL 'libSkiaSharp' or one of it's dependenties
Dotnet calls to the Nano version of Windows in the Docker container. Fortunately, since v1.68.1.1 there is a workaround to this situation.
Read more >
After upgrading .net core from 3.1 to 5 I'm getting error in ...
I have a native application written in c++ and complied into the .so library through docker which I'm using in the .net core...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found