Closed thebpmgroup closed 3 years ago
Hi,
I just had the same problem.
It seems to be a problem with:
.nuget\packages\opencvsharp4.runtime.ubuntu.18.04-x64\4.1.0.20190416\runtimes\ubuntu-x64\native\libOpenCvSharpExtern.so
which is only 3.5 MB in the release 4.1.0.20190416
.
I was able to get it working with an older version, e.g.: 4.0.1.20190326
.
where the file: .nuget\packages\opencvsharp4.runtime.ubuntu.18.04-x64\4.0.1.20190326\runtimes\ubuntu-x64\native\libOpenCvSharpExtern.so
is 62 MB big
You might wanna downgrade your nuget packages accordingly.
Take care, Martin
Reference #667 to build from source. this worked for me. You need to remove the reference to the runtime package and after everything was built and installed from source it worked for me.
Something must be wrong in the runtime nuget package.
I have tried the steps from #667 and still cannot get this to work. I am still facing the issue where the extern lib cannot be loaded. Are there any other approaches to resolve this?
I have the same issue on ubuntu 18.04 , OpenCvSharp4.runtime.ubuntu 4.1.1.20191023
Please try checking dependencies of libOpenCvSharpExtern.so
ldd libOpenCvSharpExtern.so
linux-vdso.so.1 => (0x00007ffe441ad000)
libgtk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0 (0x00007ff98a502000)
libgdk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0 (0x00007ff98a24d000)
libcairo.so.2 => /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007ff989f39000)
libgdk_pixbuf-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007ff989d17000)
libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007ff989ac4000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007ff9897b3000)
...
The latest version of libOpenCvSharpExtern.so was made by the Ubuntu18.04 docker container in CircleCI. Please try installing the same packages as it. https://github.com/shimat/opencvsharp/blob/master/.circleci/config.yml
apt -y update
apt -y install wget unzip build-essential checkinstall cmake pkg-config yasm git gfortran libjpeg8-dev libpng-dev software-properties-common
add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
apt -y update && apt -y install libjasper1 libtiff-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2-dev libv4l-dev
cd /usr/include/linux
ln -s -f ../libv4l1-videodev.h videodev.h
apt -y install libgtk2.0-dev libtbb-dev libatlas-base-dev libvorbis-dev libxvidcore-dev libopencore-amrnb-dev libopencore-amrwb-dev libavresample-dev x264 v4l-utils libwebp-dev tesseract-ocr libtesseract-dev libleptonica-dev
In the arm64 linux system, Is there any solution to the same problem? @shimat
Sorry, arm64 linux is not supported. (I'm not working on it, but there might be a solution.)
+1 for ARM64 -- working on the nvidia nano, want to see if we can use the GPU acceleration for DNN predictions. @shimat , if you want SSH to a device, I can get that info to you. (Ubuntu 18.04 also)
Just a follow up -- was able to get Arm64 running - Just simply compile it it --
For those that want what I did, since I used the Nvidia Nano for CUDA acceleration with DNN. Works like a charm!
cd opencv
mkdir release
cd release
cmake -D WITH_CUDA=ON \
-D CUDA_ARCH_BIN="5.3,6.2,7.2" \
-D CUDA_ARCH_PTX="" \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D WITH_GSTREAMER=ON \
-D WITH_LIBV4L=ON \
-D WITH_FFMPEG=ON \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_EXAMPLES=OFF \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j4
make install
I am facing the same problem on CentOS 7 x64
[root@iZk1a852gcdx6se03w7daqZ native]# ldd libOpenCvSharpExtern.so linux-vdso.so.1 => (0x00007ffc01dbb000) librt.so.1 => /lib64/librt.so.1 (0x00007fb1f570e000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb1f54f2000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fb1f52ee000) libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007fb1f50ec000) libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007fb1f4dd6000) libz.so.1 => /lib64/libz.so.1 (0x00007fb1f4bc0000) libm.so.6 => /lib64/libm.so.6 (0x00007fb1f48be000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fb1f45b7000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fb1f43a1000) libc.so.6 => /lib64/libc.so.6 (0x00007fb1f3fd3000) /lib64/ld-linux-x86-64.so.2 (0x00007fb1f93f8000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fb1f3d71000) [root@iZk1a852gcdx6se03w7daqZ native]#
what I missed or what should I check?
appreciate any help
thanks
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.
same issue, perhaps a build with ubuntu 20.04 LTS would be nice (ffmpeg libs are newer).
~/Desktop/app$ dotnet run 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 using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: /usr/lib/dotnet/shared/Microsoft.NETCore.App/7.0.11/OpenCvSharpExtern.so: cannot open shared object file: No such file or directory /usr/lib/dotnet/shared/Microsoft.NETCore.App/7.0.11/libOpenCvSharpExtern.so: cannot open shared object file: No such file or directory /usr/lib/dotnet/shared/Microsoft.NETCore.App/7.0.11/OpenCvSharpExtern: cannot open shared object file: No such file or directory /usr/lib/dotnet/shared/Microsoft.NETCore.App/7.0.11/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.imgcodecs_imread(String fileName, Int32 flags, IntPtr& returnValue) at OpenCvSharp.Mat..ctor(String fileName, ImreadModes flags) at App.Program.Main(String[] args)
------------------------------====================------------------------------ How to solve the vscode OpenCvSharp error in Ubuntu?
Encountered this issue on apple silicon, solved by changing from dotnet add package OpenCvSharp4.runtime.osx.10.15-x64 --version 4.5.1.20210208 to dotnet add package OpenCvSharp4.runtime.osx_arm64 --version 4.8.1-rc
Summary of your issue
Using VSCode and dot net core 2.2 following the instructions :+1:
When I add the following code
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