h3-java
h3-java copied to clipboard
Compatibility with graalvm native-image
Now that graal 19.3 is out and LTS, I tried to use this library in a graalvm native-image, which leads to errors like this:
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.uber.h3core.NativeMethods.getRes0Indexes([J)V [symbol: Java_com_uber_h3core_NativeMethods_getRes0Indexes or Java_com_uber_h3core_NativeMethods_getRes0Indexes___3J]
at com.oracle.svm.jni.access.JNINativeLinkage.getOrFindEntryPoint(JNINativeLinkage.java:145)
at com.oracle.svm.jni.JNIGeneratedMethodSupport.nativeCallAddress(JNIGeneratedMethodSupport.java:57)
at com.uber.h3core.NativeMethods.getRes0Indexes(NativeMethods.java)
at com.uber.h3core.H3Core.getRes0Indexes(H3Core.java:1021)
It appears that some guidance to native-image is needed for JNI and that there are partially-automated ways to generate the needed configuration, which become available to downstream users too if the config is included in the library's jar.
It isn't as simple as just using the agent on the build and testing tasks, but I'll look some more and see what it takes to generate an appropriate jni-config.json.