-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to load shared library OpenCvSharpExtern, Ubuntu 22.04 #1448
Comments
Any suggestions to fix that? I have the same error. env: ubuntu 22 and .net6 |
I have been trying to get a solution to this one too. I've been following through the steps in the github workflows and am in the process of trying to get it compiled on Ubuntu 22.04 but I'm getting stuck as well. I am working on a pull request to allow them to publish this runtime package. A brief rundown of where I'm at, I added .github/workflows/ubuntu22.yml with the following changes
At this point I'm out of ideas on what to run next. I'm running into issues of the [ 88%] Building CXX object OpenCvSharpExtern/CMakeFiles/OpenCvSharpExtern.dir/wechat_qrcode.cpp.o
[ 91%] Building CXX object OpenCvSharpExtern/CMakeFiles/OpenCvSharpExtern.dir/xfeatures2d.cpp.o
[ 94%] Building CXX object OpenCvSharpExtern/CMakeFiles/OpenCvSharpExtern.dir/ximgproc.cpp.o
make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libavresample.so', needed by 'OpenCvSharpExtern/libOpenCvSharpExtern.so'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 97%] Building CXX object OpenCvSharpExtern/CMakeFiles/OpenCvSharpExtern.dir/xphoto.cpp.o
make[1]: *** [CMakeFiles/Makefile2:98: OpenCvSharpExtern/CMakeFiles/OpenCvSharpExtern.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Error: Process completed with exit code 2. I also found this stack overflow about the difference between |
@Evelios How far did you get? I've made two NuGet packages for internal use that contain binaries for Ubuntu 20.04 and Ubuntu 22.04. I'm now working on dockerizing the creation of both. I could then turn that into a PR, would you be interested? |
Is there any reason that the nuget packages for 22.04 and 20.04 can't be uploaded to nuget? The master branch builds for 20.04 just fine, i am guessing it hasn't been thoroughly tested? If I am able to build for that target, is there a licence restriction that stop me from uploading the 20.04 version for a specific version of OpenCV (say... 4.6.0) to the nuget repository for example? |
@lewispurvis if you manage to make these two packages part of the general release procedure, it'd be really great! I'd much rather use these, than my privately maintained ones. I can share the code for building the packages, if you're interested. |
@lejsekt please share the code and make PR. This issue is blocker for me and I hope that PR will be approved. Thanks for your effort. |
We just hit the same issue upgrading from .NET Core 3.1 to .NET 6, although we are actually running on Ubuntu 18.04, but we're getting the same results here. |
Here's the code @dsoronda It's just taking the existing Dockerfile and adding a step to build a NuGet package. One can then create the package by:
However, concerning Jammy.Dockerfile, I'm just guessing the needed native deps. But the tests are passing and the OpenCV functionality I need in my project seems to work as well. |
And similar issue in another repo: sdcb/PaddleSharp#25. It might be an inspiration for how to create the package. |
$ diff -u *.Dockerfile
--- Focal.Dockerfile 2022-10-07 19:50:30.000000000 +0800
+++ Jammy.Dockerfile 2022-10-07 19:52:36.000000000 +0800
@@ -1,4 +1,4 @@
-FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal as builder
+FROM mcr.microsoft.com/dotnet/aspnet:6.0-jammy as builder
ENV DEBIAN_FRONTEND=noninteractive
ENV OPENCV_VERSION=4.6.0
@@ -21,7 +21,7 @@
libavcodec-dev \
libavformat-dev \
libswscale-dev \
- libdc1394-22-dev \
+ # libdc1394-dev \
libxine2-dev \
libv4l-dev \
libtheora-dev \
@@ -29,7 +29,7 @@
libxvidcore-dev \
libopencore-amrnb-dev \
libopencore-amrwb-dev \
- libavresample-dev \
+ libswresample-dev \
x264 \
libtesseract-dev \
libgdiplus \
@@ -122,7 +122,7 @@ |
For anyone who wants to use 4.7.0 that was released last month, @shimat has already created a dockerfile for building wget https://raw.githubusercontent.com/shimat/opencvsharp/4.7.0.20230114/docker/ubuntu22-dotnet6-opencv4.7.0/Dockerfile
docker buildx build . -o export Wait for it to complete then Before using it for your .NET application, you should check out if there are sufficient dependencies had been installed on your environment(out of the building system Ubuntu 22.04 in the docker container): ldd *.so* | grep found and install any(not need to install all of them in opencvsharp/docker/ubuntu22-dotnet6-opencv4.7.0/Dockerfile Lines 9 to 34 in 7ed8972
If you want to use a more recent version of Tesseract(
with RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository ppa:alex-p/tesseract-ocr5
&& apt-get -y install --no-install-recommends \ |
Not sure where we are with this here is where I've gotten.
Continuing using the ubuntu20.yml I was able to create a custom nupkg package which I used Then in my application I used But I still get error
The path it keeps looking for the file in is I'm not sure if I'm missing something or I just don't know what I'm doing. Both are likely true |
Where is your built result |
@n0099 It's getting installed in the Not sure I follow how that environment variable works. Will try it. I'm currently just using Update |
Oh I ran the Update Update
|
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. |
Summary of your issue
I'm trying OpenCvSharp on Ubuntu 22.04 and I'm getting following error
I'm referencing
OpenCvSharp4.runtime.ubuntu.18.04-x64
package.Environment
Ubuntu 22.04
What did you do when you faced the problem?
libOpenCvSharpExtern
is located in build folder under./bin/Debug/net6.0/runtimes/ubuntu.18.04-x64/native/
instead./bin/Debug/net6.0/
. So runningldd libOpenCvSharpExtern.so
returnsshell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Then I copied
libOpenCvSharpExtern.so
to./bin/Debug/net6.0/
and try to run application from there resulting in same :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
exception.Then I run
ldd libOpenCvSharpExtern.so
again resulting in :So, I have few questions like:
libOpenCvSharpExtern.so
in proper location ?I would like to use OpenCvSharp but this is blocking me for using it.
Example code:
Output:
What did you intend to be?
Compile and run.
The text was updated successfully, but these errors were encountered: