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

Add logging to the Loader process to allow debugging it #41

Closed
ladrl opened this issue Sep 23, 2015 · 3 comments
Closed

Add logging to the Loader process to allow debugging it #41

ladrl opened this issue Sep 23, 2015 · 3 comments

Comments

@ladrl
Copy link

ladrl commented Sep 23, 2015

I try to use JavaCV in our project and it works fine for Windows and Android. But for the Jenkins CI (which runs in a Docker Image) the libraries are not found.
This problem is quite hard to track down as I do not have access to the CI infrastructure - and it this case it would be nice to just enable verbose logging for the Loader and get detailed information about what is tried and what goes wrong.

Are there specific reasons that there is no logging in the Loader at the moment?

@ladrl
Copy link
Author

ladrl commented Sep 23, 2015

The specific exception I try to debug is:

java.lang.UnsatisfiedLinkError: no jniopencv_imgcodecs in java.library.path
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
    at java.lang.Runtime.load0(Runtime.java:795)
    at java.lang.System.load(System.java:1062)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:539)
    at org.bytedeco.javacpp.Loader.load(Loader.java:415)
    at org.bytedeco.javacpp.Loader.load(Loader.java:358)
    at org.bytedeco.javacpp.opencv_imgcodecs.<clinit>(opencv_imgcodecs.java:13)
       < application frames omitted >

From what I see here it seems that the call to System.load actually creates this exception - but it is inside a try-catch block swallowing the exception. No nested exceptions are listed. So how come I get this trace?

@saudet
Copy link
Member

saudet commented Sep 23, 2015

The Loader tries a lot of things to get things loaded, and a lot of exceptions get thrown around, so only what appears the most relevant one(s) are actually thrown, but it doesn't always get it right. Anyway, most of the time, the reason why it fails is because there are some missing system files from the underlying operating system, so use ldd or whatever your OS provides to check if it can get the libraries loaded or not.

As for the actual request of this issue, there's no reason why it's not logging anything right now. Actually, I've added some logging to the Pointer class recently: 9ff6d93
So, if you feel like making yourself useful, instead of just complaining, please take the time to implement something sensible in a similar fashion and send me a pull request, thank you!

@saudet
Copy link
Member

saudet commented Oct 30, 2015

Added in JavaCPP 1.1. Thanks for the suggestion!

@saudet saudet closed this as completed Oct 30, 2015
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