hyperxpro/Brotli4j

Not able to load brotli native library on ppc64le architecture

Balavva-Mirji opened this issue · 16 comments

Hello, we are trying to provide ppc64le support for this repo. We are getting below error while testing it on ppc64le.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'https://github.com/Balavva-Mirji/Brotli4j/tree/ppc64le'
  2. Install required dependencies like java & maven
  3. mvn clean package
  4. See the error: Brotli4jLoaderTest.load:29 Unexpected exception thrown: java.lang.UnsatisfiedLinkError: Failed to load Brotli native library

Note: After building brotli native library on ppc64le, we have set LD_LIBRARY_PATH.

Expected behavior
It should not thrown the above error which I mentioned as we built brotli native on ppc64le.

Logs

[ERROR] com.aayushatharva.brotli4j.decoder.BrotliInputStreamTest Time elapsed: 0.03 s <<< ERROR!
java.lang.UnsatisfiedLinkError: Failed to load Brotli native library
at com.aayushatharva.brotli4j.Brotli4jLoader.ensureAvailability(Brotli4jLoader.java:109)
at com.aayushatharva.brotli4j.decoder.BrotliInputStreamTest.load(BrotliInputStreamTest.java:35)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
Caused by: java.lang.UnsupportedOperationException: Unsupported OS and Architecture: Linux, ppc64le
at com.aayushatharva.brotli4j.Brotli4jLoader.getPlatform(Brotli4jLoader.java:146)
at com.aayushatharva.brotli4j.Brotli4jLoader.(Brotli4jLoader.java:53)
... 3 more
[INFO] Running com.aayushatharva.brotli4j.decoder.DecoderTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.002 s <<< FAILURE! - in com.aayushatharva.brotli4j.decoder.DecoderTest
[ERROR] com.aayushatharva.brotli4j.decoder.DecoderTest Time elapsed: 0.002 s <<< ERROR!
java.lang.UnsatisfiedLinkError: Failed to load Brotli native library
at com.aayushatharva.brotli4j.Brotli4jLoader.ensureAvailability(Brotli4jLoader.java:109)
at com.aayushatharva.brotli4j.decoder.DecoderTest.load(DecoderTest.java:35)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
Caused by: java.lang.UnsupportedOperationException: Unsupported OS and Architecture: Linux, ppc64le
at com.aayushatharva.brotli4j.Brotli4jLoader.getPlatform(Brotli4jLoader.java:146)
at com.aayushatharva.brotli4j.Brotli4jLoader.(Brotli4jLoader.java:53)
at com.aayushatharva.brotli4j.decoder.BrotliInputStreamTest.load(BrotliInputStreamTest.java:35)
... 2 more

Platform (please complete the following information):

  • Device: [e.g. Linux]
  • OS: [Ubuntu]
  • Java Version [11]

Additional context
We have replicated this PR changes on ppc64le local machine.

Kindly let me know if I am missing anything here or if you need any other information on this, I am exploring further on this.
Any suggestions/comments are highly appreciated.
Thanks in advance!

Native library is able to build locally:

file libbrotli.so
libbrotli.so: ELF 64-bit LSB shared object, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked, BuildID[sha1]=8492ac089bfeacce07e548ac68bd3a82f8238447, not stripped

Most likely this is due to wrong architecture name. Try to print the os.arch value and see.

Do a PR so I can see the build logs.

Most likely this is due to wrong architecture name. Try to print the os.arch value and see.

it's ppc64le

@hyperxpro Thanks for pointing it out. It' working fine now. Will come up with PR.

Perfect! Sorry, I forgot to follow up since I was on vacation. Looking forward to your PR. :)

@hyperxpro I need a assistance from you before raising the PR.
Like do we need to provide any ppc64le machine?
Could you please confirm on this..

#102

Check this. You need to provide CI build, native module directory and add new architecture type in main module to auto load.

@hyperxpro thanks for the reply.
I have gone through above PR.
Made the changes on my forked repo.
Reference: Balavva-Mirji@bbcc352
And it works perfectly on ppc64le local machine.
Just curious on which machine s390x native builds are running? Because in the above PR, I don't see any VM providing which is specific to s390x.

You need to add it to CI like this:

Linux-s390x-Build-JDK11:

@hyperxpro can we connect on this? if you have sometime

Sure, hit me on Discord: hyperx_pro

I am sorry, didn't get you

Mhmm, are you looking to DM for help? If yes then Discord.

Yes, I got that. Not getting that Discord thing

Looks like you're not familiar with Discord 😅

Nvm, Just do a PR with whatever you have and I will take care of CI builds.