Skip to content
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

UnsatisfiedLinkError: no jniopencv_ximgproc #1502

Closed
kwatters opened this issue Sep 8, 2020 · 2 comments
Closed

UnsatisfiedLinkError: no jniopencv_ximgproc #1502

kwatters opened this issue Sep 8, 2020 · 2 comments

Comments

@kwatters
Copy link
Contributor

kwatters commented Sep 8, 2020

I've been working on an image segmentation example. The example uses ximgproc. I'm on windows 10, 64 bit, using java8.
This is javacv 1.5.3

In particular i'm trying to do the following

import static org.bytedeco.opencv.global.opencv_ximgproc.createSelectiveSearchSegmentation;
followed by:
Loader.load(opencv_ximgproc.class);

This gives me an exception:

`java.lang.UnsatisfiedLinkError: no jniopencv_ximgproc in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1631)
at org.bytedeco.javacpp.Loader.load(Loader.java:1265)
at org.bytedeco.javacpp.Loader.load(Loader.java:1109)
at org.bytedeco.opencv.global.opencv_ximgproc.(opencv_ximgproc.java:31)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.bytedeco.javacpp.Loader.load(Loader.java:1176)
at org.bytedeco.javacpp.Loader.load(Loader.java:1125)
at org.myrobotlab.opencv.OpenCVFilterImageSegmenterTest.setup(OpenCVFilterImageSegmenterTest.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\kwatters.javacpp\cache\opencv-4.3.0-1.5.3-windows-x86_64.jar\org\bytedeco\opencv\windows-x86_64\jniopencv_ximgproc.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1581)
... 36 more

`

Other libraries load just fine... perhaps there is something with how jniopencv_ximgproc.dll is created? maybe i'm missing some other transient dependencies in my system classpath? I'll try to debug more and provide detail. The dll that it's referencing the the error message does exist on the filesystem. (i have also deleted my ~/.javacpp cache and saw the dll's get re-created when i ran it again.. )

@kwatters
Copy link
Contributor Author

kwatters commented Sep 8, 2020

Ok.. so a little update.. interestingly, if I first load the "opencv_video.class" , then i am able to successfully run my code.

Loader.load(opencv_video.class); Loader.load(opencv_ximgproc.class);

It seems like, there is a dependency loading order that needs to occur, the opencv_video stuff needs to be loaded before using ximgproc. Curious if there's a better workaround or fix for this...

@saudet
Copy link
Member

saudet commented Sep 9, 2020

Duplicate of bytedeco/javacpp-presets#911

@saudet saudet marked this as a duplicate of bytedeco/javacpp-presets#911 Sep 9, 2020
@saudet saudet closed this as completed Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants