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 org.bytedeco.javacpp.opencv_core$Mat.allocate() #9

Closed
DerTomm opened this issue May 31, 2014 · 14 comments
Closed
Labels

Comments

@DerTomm
Copy link

DerTomm commented May 31, 2014

Using the new 0.8 release of JavaCV I get the following exception as soon as I try to instantiate a Mat object:

Exception in thread "Thread-1" java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.opencv_core$Mat.allocate()V at org.bytedeco.javacpp.opencv_core$Mat.allocate(Native Method) at org.bytedeco.javacpp.opencv_core$Mat.(opencv_core.java:6210) at org.bytedeco.javacpp.helper.opencv_core$AbstractMat.(opencv_core.java:2371)

All needed libraries are included via Maven. As far as I see it is not a missing library problem. My assumption is that java native interface and library function are not matching completely.

@saudet
Copy link
Member

saudet commented May 31, 2014

This is a known issue with JavaCPP:
bytedeco/javacpp#1
The latest code fixes that. Binary snapshot released here:
https://oss.sonatype.org/content/repositories/snapshots/org/bytedeco/javacpp/0.8-2-SNAPSHOT/

@saudet saudet closed this as completed May 31, 2014
@DerTomm
Copy link
Author

DerTomm commented Jun 2, 2014

Thanks for the hint.

Unfortunately using the latest snapshot release of javacpp does not solve the problem. This is the dependency section of my pom.xml:

<dependency>
    <groupId>org.bytedeco</groupId>
    <artifactId>javacv</artifactId>
    <version>0.8</version>
    <exclusions>
        <exclusion>
            <artifactId>javacpp</artifactId>
            <groupId>org.bytedeco</groupId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>org.bytedeco</groupId>
    <artifactId>javacpp</artifactId>
    <version>0.8-2-SNAPSHOT</version>
</dependency>

As far as I see Maven then fetches javacpp-0.8-2-20140531.040139-1.jar which is the most recent one.

Did I forget something to get Maven using the correct javacpp lib?

@saudet
Copy link
Member

saudet commented Jun 3, 2014

That should work, but maybe Gradle is still pulling JavaCPP 0.8, so you
could try 0.8-2-SNAPSHOT for JavaCV as well...

@DerTomm
Copy link
Author

DerTomm commented Jun 7, 2014

I think I have to wait for the next regular release. Even with this dependency configuration I get the described exception:

    <dependency>
        <groupId>org.bytedeco</groupId>
        <artifactId>javacv</artifactId>
        <version>0.8-2-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.bytedeco</groupId>
        <artifactId>javacpp</artifactId>
        <version>0.8-2-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>opencv</artifactId>
        <version>2.4.9-0.8-2-SNAPSHOT</version>
    </dependency>

@saudet
Copy link
Member

saudet commented Jun 7, 2014

You forgot to include the platform-specific artifact:
http://bytedeco.org/download/

@DerTomm
Copy link
Author

DerTomm commented Jun 8, 2014

Thanks for your continous help - but even by listing all platform specific dependencies (as described in your link) together with the 0.8-2-SNAPSHOT main libs (javacv, javacpp and javacpp-presets) the exception remains existing...

@saudet
Copy link
Member

saudet commented Jun 9, 2014

So, could you please try to add the JAR files manually to your CLASSPATH?
If that works, we will know that it's a problem related with Gradle...
thanks!
2014/06/08 23:29 "DerTomm" notifications@github.com:

Thanks for your continous help - but even by listing all platform specific
dependencies (as described in your link) together with the 0.8-2-SNAPSHOT
main libs (javacv, javacpp and javacpp-presets) the exception remains
existing...


Reply to this email directly or view it on GitHub
#9 (comment).

@DerTomm
Copy link
Author

DerTomm commented Jun 9, 2014

Hi Samuel,

adding the JAR files manually to the classpath does not change the behaviour. I tried it with the original 0.8 version from bytedeco.org/download as well as with the recent snapshot release.

Regards,
Thomas

@saudet
Copy link
Member

saudet commented Jun 9, 2014

What's your platform again? Can you let me know what a call to Loader.getPlatform() returns? Thanks

@DerTomm
Copy link
Author

DerTomm commented Jun 9, 2014

Loader.getPlatform() return windows-x86_64 which is the correct platform. OS is Windows 8.1 x64, Java runtime is 7u51.

@saudet
Copy link
Member

saudet commented Jun 10, 2014

Ok, that platform works fine here, so let's see. Could you try to extract manually all the DLLs from the JAR files and put them somewhere in your system PATH? Let's see if that works this way first, and let's think about other things after that. Thanks

@DerTomm
Copy link
Author

DerTomm commented Jun 11, 2014

Yep - I will try to do this tomorrow evening.

@DerTomm
Copy link
Author

DerTomm commented Jun 15, 2014

Today I could try to extract the DLLs. Here the steps I did:

  • Deleted all the previously fetched libraries
  • Removed all dependencies entries from maven pom.xml
  • Downloaded the version 0.8 binaries from bytedeco.org
  • Replaced javacv, javacpp and javacpp-presets (win32_x64) with most recent snapshots
  • Extraced all DLLs from javacpp-presets
  • Deleted javacpp-presets.jar and removed from build path

Unfortunately exactly the same behaviour - UnsatisfiedLinkError. But I think there is something strange about it. Even if I remove all DLLs from the system path I get the same exception. Shouldn't the exception differ if the DLLs are really not existing? As far as I remember when I used JNI for the first time I got something like "library not found" as exception in that case.

Is there an opportunity to find out whether and where the application gets the DLLs from?

@saudet
Copy link
Member

saudet commented Jun 16, 2014

You might be able to diagnose what it's picking up with http://www.dependencywalker.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants