Closed DvD12 closed 4 years ago
Running MONO_LOG_LEVEL=debug mono
Mono: DllImport error loading library 'libOpenCvSharpExtern.so': '/usr/local/lib/libOpenCvSharpExtern.so: undefined symbol: _ZTIN2cv16ParallelLoopBodyE'.
So the compiled library is found but it complains about undefined symbols.
A few people have already had this issue and everyone seems to agree that the problem is inconsistency between compiler and openCV sources being used. I don't think that is the problem though:
Therefore there is no way the compiler is using the "wrong" version as there is no other openCV version besides the one I installed.
Wiki says this only works for 2.4.10 but I thought that was an old reference. I might have to try and see if downgrading works.
@DvD12 Hi, are you able to make it working on Linux? I've tried downgrading, but without success.
Nope, I haven't. As much as I like OpenCVSharp's ease of use I had to resort to EMGU. Installing it with NuGet works without the need of any further workaround both in VS and in Mono.
I'm seeing the very same error on NixOS. opencv_version
is reporting 3.2.0 and it is under this that I built libOpenCvSharpExtern.so
. I am using the 3.2 release of OpenCvSharp from the release page (not NuGet).
That's building it with nix-shell --pure
and the following shell.nix
{ pkgs ? import <nixpkgs> {} }:
let stdenv = pkgs.stdenv;
in stdenv.mkDerivation {
name = "opencvsharp";
buildInputs = with pkgs; [
cmake
mono
(pkgs.opencv3.override { enableContrib = true; })
];
}
Okay, I just looked at the CMakeLists.txt
and this build is all kinds of mangled.
ldd
on the resultant file doesn't show me linking with anything remotely related to OpenCV. CMake's variables for OpenCV_INCLUDE_DIR
, OpenCV_LIBRARY_DIR
, and OpenCV_LIBRARIES
are all completely empty when I run.
As far as I can tell, the build neither tries to find OpenCV, nor to link with it.
I was able to get this to run on NixOS by deleting src/cmake/Modules/FindOpenCV.cmake
altogether, and applying the below diff:
diff --git a/src/OpenCvSharpExtern/CMakeLists.txt b/src/OpenCvSharpExtern/CMakeLists.txt
index ea40878..6d7210c 100644
--- a/src/OpenCvSharpExtern/CMakeLists.txt
+++ b/src/OpenCvSharpExtern/CMakeLists.txt
@@ -1,6 +1,12 @@
-include_directories(${OpenCV_INCLUDE_DIR})
-link_directories(${OpenCV_LIBRARY_DIR} ${OpenCV_LIBRARIES})
+find_package(OpenCV REQUIRED)
+if(OpenCV_FOUND)
+ message("Found OpenCV")
+ message("Includes: " ${OpenCV_INCLUDE_DIRS})
+endif(OpenCV_FOUND)
+
+include_directories(${OpenCV_INCLUDE_DIRS})
+link_directories(${OpenCV_LIBS})
set(OPENCVSHARP_FILES
bgsegm.cpp
@@ -24,6 +30,7 @@ set(OPENCVSHARP_FILES
)
add_library(OpenCvSharpExtern SHARED ${OPENCVSHARP_FILES})
+target_link_libraries(OpenCvSharpExtern ${OpenCV_LIBS} )
install(TARGETS OpenCvSharpExtern
RUNTIME DESTINATION bin
I suspect this broke things on Windows but I haven't tried it.
Later note: This lets things run further, but then I run into what was described in https://github.com/shimat/opencvsharp/issues/85#issuecomment-255036540 with System.EntryPointNotFoundException: imgcodecs_imread
.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Environment Lubuntu 16.10 (x86)
Steps followed
I've used the following code in Program.cs:
Errors encountered As I build my project and run it, I encounter the following error:
I'm not sure what to do. Program asks for a .dll but I have an .so? Not sure if this has something to do with the problem. I've just followed the wiki, which says
which is what I've done, but this is not helping. Any help?