-
Notifications
You must be signed in to change notification settings - Fork 66
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
[Proposal] Include libdisni.so into assembly jar #17
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Peter Rudenko <[email protected]>
Hi Peter, |
I remember we have discussed the leveldbjni approach, not sure we came to a conclusion though. I think the approach presented by this pull request is not bad as it automatically builds libdisni when building the jar, but does not include binaries into a jar. |
It includes libraries into jar: https://github.com/zrlio/disni/pull/17/files#diff-6c01060f17a19807e7ef9d8221b3e43aR51 |
Adding a shared library to the assembly jar and load it from there may work for small applications, any larger system anyway would need a more systematic approach to managing the CLASSPATH and LD_LIBRARY_PATH. I'm not so convinced adding to the jar is a good idea. |
In assembly jar there's only libdisni binary, all other libraries (spdk, dpdk, etc.) should be managed by LD_LIBRARY_PATH. The issue if use disni as dependency library need to have 1:1 correspondence to libdisi. E.g. 1 library may depend from disni-1.3 another one from disni-1.4-SNAPSHOT (with ODP MR prefetch). In this case need to set separate LD_LIBRARY_PATH so each corresponds to its own libdisni. If libdisni would be in assembly jar, then just to add maven dependency, and no compilation or setting separate LD_LIBRARY_PATH needed |
Understand there is a dependency here between disni and libdisni, but that can be solved by having both libraries export versions and have disni check if the loaded libdisni has the right version. Adding it to the assembly which then copies is to some local folder which at runtime may or may not exist on the given platform, combined with other potential runtime problems like the library being incompatible with the platform, or the library already being in the LD_LIBRARY of the system (e.g., Crail) making it unclear which version gets loaded, etc.., all this gives me a gut feeling that using this approach in a real large system creates all sorts of problem. It may at best be a solution for small hello world applications. |
No need to extract to some folder. It was just an example. Totally possible to read from jar itself. Here's for example netty (not hello world app): |
I also think that generally the jar is not a good place for binaries besides .class files. However I understand that from a usability perspective this is nice if it works like advertised (every platform etc.). We should put some effort into creating package builds for the big distros, e.g. debs and rpms and see if we can get this into their repositories. I believe the chance is higher now since it is used by an Apache project. |
I would prefer not to include binaries in jars. As far as I remember, we did not conclude to include libdisni in the jar. A much cleaner solution is to create packages like deb or rpm (as Jonas said). This will lead to less problems than trying to include binaries for different architectures and platforms. |
This will include libdisni into assembly jar, thus not require to mess with
LD_LIBRARY_PATH
, etc, allowing to have different disni versions for different components. Making PR for discussion if everything's OK will submit to gerrit.This approach used by many popular libraries with jvm/jni. E.g. xgboost
cc: @yuvaldeg