-
Notifications
You must be signed in to change notification settings - Fork 744
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
Java module errors: no jnilept in java.library.path / cannot access class TessBaseAPI #814
Comments
I'm pretty sure the sample project here works: |
It simply looks like Leptonica is missing from the class/module path though. |
This worked! I added By the way, I am sitting just a few floors below your old lab in McConnell Engineering. From one McGill grad student to another, thanks for publishing javacpp and all the presets. I've been following your work on Bytedeco for some time, keep up the great work! |
I see, thanks for testing! Looking more closely as this, I think we could add a You're a student working as part of MILA? I'm glad to hear that my work is useful there! Let me know if there's anything I can do to help you guys more. Thanks /cc @HGuillemet |
Okay, so I forked and cloned the parent repo as suggested, added the line
but encountered the same error as before (
I slightly regret upgrading to Java 9+, but wanted to take advantage of the new jlink/jpackage functionality. Anyhow, I appreciate your earlier support, which led to the correct solution. Re: Mila/JavaCPP. Speaking for myself, but it's definitely been helpful. Zero configuration, very straightforward to setup and use. We've been discussing adding GPU support for our AD library, in which case we might use the CUDA presets. Right now, just using it for some side projects, but it's probably the smoothest FFI I've ever had to use. Thanks again for your time and energy on this project. |
I see, so JPMS is very much clunky at this stage, yes. We can still use the class path with Java 9+ though. It's also possible to use Your project looks very interesting! I'm sure @treo will start looking at that right away :) Thanks for sharing and keep us informed of your progress. |
The tesseract.platform module has dependencies towards all native modules. The tesseract module does not. So using the tesseract module is the way to go when you build for specific platform(s) and want to avoid all foreign native modules. You should be able to simple do:
instead of:
(no need for both, the native module has a transitive dependency towards the java one).
That said, neither work as is because the tesseract native modules should "require" the leptonica native modules since the tesseract library is linked towards the leptonica native library, and it doesn't. I think adding the
Since this situation should arises in many other presets, we can simplify and instead define a new maven property. Something like:
and use this property in the moditect section of parent pom. |
Concerning the android specific problem: in modules for android, native libraries are located in
Solutions I see:
|
A new property sounds good, please give it a try!
As for the Android modules, if we can exclude them entirely from the JPMS
modules, that sounds fine, but will it let us do that without also removing
the Maven modules?
|
I don't really understand the problem with Android. If JPMS is not implemented on Android, how the split package error can show up ? Are you sure there isn't a simple workaround to this error, similar to the use of |
JPMS is probably going to complain about having non-modular JAR files in its path, no? Android actually "installs" libraries in the |
If the android jars do not contain a module-info, that could work. The split package error with |
I can't seem to reproduce that issue with the |
Sure, to reproduce the error described above, please run
|
Thanks! Can you reproduce it outside Gradle with a single |
Oh, I see, it's an error that occurs at runtime. Why would it wait for runtime to report build errors? Weird... How can we fix this? I tried to declare those modules using only
Consequently, excluding those JAR files entirely from the platform modules appears to be the only way to solve this, which is fine I guess since Android doesn't support JPMS or |
If I understand well, this error only happens at runtime, only when including the android package in the module path, and only when running on a non-android system (as long as android doesn't support JPMS).
I'd say first option is better because it won't change anything for current users but maybe this is technically too difficult for a reason I don't see. |
Either option would require developer time and increase the cognitive load for end users... For now, just removing the Android modules from the |
Removing the |
We don't need to change those, just the platform artifacts. |
Ok, I misread, sorry. |
@HGuillemet Could you send a pull request for that too? Unless you can think of something better... |
Done. Something better would be IMO as discussed above to keep the same directory structure in native jars for all platforms. And have JavaCPP install the libs in the directory expected by Android, either in |
Thanks! We can't put binaries anywhere we want on Android. Well, technically we can do anything we want, but realistically you don't want to go against Google. The only thing that it supports officially are AAR files. |
Fix from @HGuillemet has been released with version 1.5.3. Thanks! And thanks for reporting and for testing @breandan! |
BTW, there is now a plugin for Gradle to exclude by platform names: |
Does JavaCPP publish Leptonica presets for
|
No, not yet, but contributions are welcome, see issue #1069. |
* Introduce `macosx-arm64` builds for Leptonica and Tesseract (issue #814) * Upgrade presets for zlib 1.2.12
@breandan I've introduced |
Thanks @saudet, much appreciated! Hope you're doing well. |
When I declare the following
module-info.java
on JDK 13:I receive the following error:
no jnilept in java.library.path: [/Developer/NVIDIA/CUDA-9.1/lib, /Users/breandan/Library/Java/Extensions, /Library/Java/Extensions, /Network/Library/Java/Extensions, /System/Library/Java/Extensions, /usr/lib/java, .]
When I modify the
module-info.java
to use the.platform
dependency:The following error occurs:
cannot access class org.bytedeco.tesseract.TessBaseAPI (in module org.bytedeco.tesseract) because module example does not read module org.bytedeco.tesseract
.I have tried a bunch of variations of
transitive
and requiring both dependencies, to no avail. Do you have any suggestions? Thank you!The text was updated successfully, but these errors were encountered: