Skip to content
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

Exception in thread "main" org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=AIX and os.arch=ppc64 #603

Open
ThakkarChandresh opened this issue Oct 7, 2024 · 3 comments

Comments

@ThakkarChandresh
Copy link

I've observed that while running the snappy in the IBM AIX 7.2 it gives the error,

Exception in thread "main" org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=AIX and os.arch=ppc64
        at org.xerial.snappy.SnappyLoader.findNativeLibrary(SnappyLoader.java:345)
        at org.xerial.snappy.SnappyLoader.loadNativeLibrary(SnappyLoader.java:179)
        at org.xerial.snappy.SnappyLoader.loadSnappyApi(SnappyLoader.java:157)
        at org.xerial.snappy.Snappy.init(Snappy.java:70)
        at org.xerial.snappy.Snappy.<clinit>(Snappy.java:47)

I've tried to find the RCA, to do so I've first manually put the aix related native libraries and passed them as variables

jdk/bin/./java -Dorg.xerial.snappy.lib.path=/tmp -Dorg.xerial.snappy.lib.name=libsnappyjava.a -cp Demo.jar:lib/* com.demo.Bootstrap

And it worked! So I tried to find that by default (if we're not passing any variable) why it's not able to find that file?

So I've added a print statement and tried to debug, there I've noticed that it tries to find the file at the correct destination, But what I've noticed is that the file extension is different.

has resource /org/xerial/snappy/native/AIX/ppc64/libsnappyjava.so

And the native file that is present in the jar have a different file extension,

total 264
-rw-r--r-- 1 root root 266695 Aug  7 05:49 libsnappyjava.a
root@demo:/demo/snappy/org/xerial/snappy/native/AIX/ppc64#

And in the code, the file's extension is entirely dependent on the System class, And the System class it self returns the .so extension instead of .a and this extension issue is also a very popular issue.

So what's the correct extension?? Is there no alternate way than passing the variable??

@xerial
Copy link
Owner

xerial commented Oct 8, 2024

We haven't updated IBM AIX native libraries (.a) for almost 7 years since the last contribution from @odaira-san:
https://github.com/xerial/snappy-java/tree/master/src/main/resources/org/xerial/snappy/native/AIX

I guess there was some system-side change around IBM AIX or JDK library to return .so instead of .a extension at

snappyNativeLibraryName = System.mapLibraryName("snappyjava");

As the current native library is quite old, if possible, I'd like to receive a pull request to update it, compiled with the make native command. If .so is the current default extension, that command will generate a .so file.

@ThakkarChandresh
Copy link
Author

I will try to generate the native library, if it works in IBM AIX then I will raise a PR.

@ThakkarChandresh
Copy link
Author

I'm a little bit unaware of the native library building, it would be better if you had some reference for it like where is the code of the native library how I can clone it, and where I can execute a make command to build the native library and all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants