-
Notifications
You must be signed in to change notification settings - Fork 232
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
GraalVM: Caused by: org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=Linux and os.arch=x86_64 #429
Comments
i am encountering this too -- the native library loads fine on jvm, just not native image |
SnappyLoader tries to copy a native lib inside https://github.com/xerial/snappy-java/tree/master/src/main/resources/org/xerial/snappy/native using the code at It seems the behavior of finding resources from the classpath is different between GraalVM and JVM. |
Just checking a month after, anyone can help one this issue please? |
Think this may be of help @patpatpat123 but I also see that instead of throwing Exception, snappy could fallback to -Djava.library.path which I don't think it does now |
FYI: Currently, I have no idea how I can fix this issue mainly because I'm not a user of GraalVM. So I will not work on this unless there will be a PR. The problem looks like just finding resource files (.so files) from the classpath (or inside the jar file) in GraalVM. |
I tried the resource, adding it when running the graalVM native image, and unfortunately, the issue still persists. I guess I can just cross my fingers for when the fix will be available.. |
Thank you for your input. Just to avoid misunderstanding, I should include the Also, what should be the value- H: IncludeResources**=abc** ? Thank you |
@patpatpat123 I just verified that this is actually quite easy to do at build-time: so the complete call would look like this inspect the snappy-jar to find the native libs @xerial this is not something that can be fixed/changed from the library side |
It seems sqlite-jdbc, which is using the same mechanism for loading native library at runtime, can support GraalVM https://github.com/xerial/sqlite-jdbc#graalvm-native-image-support Probably we can borrow the same technique |
Hey team, I tried this:
Based on the same example from sqlite. However, it is still not working, still same issue. May I ask if I did something wrong in my command? |
@patpatpat123 {
"bundles": [],
"resources": {
"includes": [
{
"condition": {
"typeReachable": "org.xerial.snappy.Snappy"
},
"pattern": "org/xerial/snappy/native/Windows/[a-z_0-9]+/snappyjava.dll"
}
]
}
} Add build args in pom.xml like this: |
I have same issue on Linux and could NOT resolve it by adding resource to native image like below.
The only workaround I found is to copy the libsnappyjava.so to same folder with executable and pass parameters, but that is pretty dirty fix I guess. |
@pavelorehov Maybe you can try to modify resource-config.json like below:
And you can add native maven build args
|
Thanks a lot @liuxgo it works fine with fixes you suggested.
Build log:
|
Would be great if snappy will contribute the fix to below repo so that consumers would only pick relevant version and rest will happen automatically. https://github.com/oracle/graalvm-reachability-metadata/tree/master |
Not sure if this is a different issue, but using the system property
and I'm wondering if the line should actually be |
@thimmwork I think you can use the property |
Unfortunately, you cannot. When setting
|
I think the original author found a real issue here. Would it be possible for the authors of this repo to provide a fix to remediate that? Thank you |
Not only an issue of kafka consumer, but also for {"timestamp":"2024-08-05T12:34:11.355+0200","level":"WARN","thread":"main","logger":"org.springframework.beans.factory.support.DisposableBeanAdapter","message":"Custom destroy method 'pushAndCloseBlockingly' on bean with name 'prometheusRSocketClient' propagated an exception: org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=Linux and os.arch=x86_64","context":"default"} I am going to try the workaround but it would be great like @KafkaProServerless mentioned if the author of this repository could provide the corresponding resource-config.json files. |
Hi all, Although I'm the author of this library, I don't know much about GraalVM, and personally, I don't have any immediate need to support it for snappy-java. If the problem can be fixed in a pull request, I'd be happy to merge it and release a new version. If further communication with Oracle is necessary, I need support to do so. |
I am going to create the PR. 👍 |
Released a new version with a fix in #590 https://github.com/xerial/snappy-java/releases/tag/v1.1.10.6 |
Hey @xerial just wanted to let you know that my tests with the new release were successful. ✔️
<dependency>
<artifactId>snappy-java</artifactId>
<groupId>org.xerial.snappy</groupId>
<version>1.1.10.6</version>
</dependency>
So the |
@klopfdreh Awesome! Thanks for checking. I appreciate your PR, which fixed this long-standing issue. |
Hello team,
This is my first issue in this repo.
Is not anything, big thanks for this very cool project.
I would like to reach out in order to report an issue:
My project is a GraalVM native image project, a simple Kafka consumer.
In my dependencies, I do have the most recent Snappy:
On my machine, Ubuntu, I do have Snappy installed.
Yet, when running the application, I am facing this 100% reproducible issue:
Could you please help on this issue?
The text was updated successfully, but these errors were encountered: