-
Notifications
You must be signed in to change notification settings - Fork 463
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
Setting JEP native library path for java >10 #688
Comments
Limiting the settings to linux 64, so far I didn't manage to get anything working here via Gradle. It's possible to add the system property to tasks like this:
But it overrides the normal The following also fails for the same reason:
|
For the linux 64 settings did you modify anything in the code? Is there a branch perhaps? About the gradle stuff, I could not test it on my macOs, but how about something like this?
|
The change would be in gradle to pass an extended |
I will test it thanks ! |
OK, I'm not sure how helpful this is, but I managed to get it work with JDK 14 on macOs using the command line stuff (not gradle). After several attempts in settings the
I'm using a conda environment called
Said that, I have no idea how to make it usable |
Today I stumbled upon a thread on stackoverflow where one of the comments seems an updated solution for JDK > 12. I haven't tried, though. |
Thanks for the experiments! So you observed the same issue with Gradle. I think the goal is to have it working with Gradle, and/or dynamically. The solution with the I got the
It could work! It requires even more parameter settings in Gradle. It involves both dynamical loading and settings at launch. Then we need to try older JVM versions compatibility? If we could find a solution equivalent to or via the |
Did you try the example I posted before that should extend the list of paths? it does not work? |
Sorry, I've tried and it works ! I just had to include also the path to grobid-home/lib/lin-64 for other libraries.
🙌 ✨. This is great, now we normally only need to make it OS specific and apply it to the run task. |
I started a PR for this #921 |
I am opening a specific issue for this, although it was mentioned #603.
The JEP instance will load itself the native JEP library, but for this to happen we need to add the path to this native library in the
java.library.path
. So far it was done dynamically, via the userusr_paths
field where we appended the JEP native path, and only if some Deep Learning model was required by the config. Unfortunatelyusr_paths
could not be accessed any more as Field via the ClassLoader from Java 11 for security reason.A possible solution is to use MethodHandler as explained here but it seems not working then for java <9 and stops working again for java 15 because
usr_paths
cannot be accessed via the ClassLoader any more at all (Caused by: java.lang.NoSuchFieldError: usr_paths
).So adding new paths for native libraries at runtime in Java seems a dead end.
The alternative would be to add the JEP native path when launching the JDK via Gradle, with something like this:
If JEP is not used, the library won't be loaded and this path won't be used anyway, so it's not a problem to add the path every time at launch.
For this, we need to identify the right OS info from Gradle (see maybe here for an example), but also normally the version of the JDK and the version of python installed locally...
Note: It does not affect the docker image which will always work fine. In the case of the Docker image, the right JEP is in the system library path because it is fully installed at system-level on the image, and we are not using the embedded native JEP library at all.
The text was updated successfully, but these errors were encountered: