Would it be possbile to include the .dlls in the binary download? #196

Closed
opened 2026-01-29 20:39:41 +00:00 by claunia · 8 comments
Owner

Originally created by @buletti on GitHub (Sep 29, 2017).

Hi,

would it be possible to include the .dll files in the binary downloads for Windows?
The .dlls are kind of needed to make the JNI wrappers work. This is especially a problem for the encoder as there is no Java implementation (which is a huge adoption problem IMHO).

I already tried to build the .dlls myself with CMake and MinGW, but I was not able to make the JNI encoder wrapper work with them. I always got an UnsatisfiedLinkError on instantiation with libbrotlicommon.dll and libbrotlienc.dll loaded.

java.lang.UnsatisfiedLinkError: org.brotli.wrapper.enc.EncoderJNI.nativeCreate([J)Ljava/nio/ByteBuffer;
at org.brotli.wrapper.enc.EncoderJNI.nativeCreate(Native Method)
at org.brotli.wrapper.enc.EncoderJNI.access$000(EncoderJNI.java:15)
at org.brotli.wrapper.enc.EncoderJNI$Wrapper.(EncoderJNI.java:36)
at org.brotli.wrapper.enc.Encoder.compress(Encoder.java:159)
at org.brotli.wrapper.enc.Encoder.compress(Encoder.java:196)

I suspect it has to do with gcc using symbols incompatible with JNI and me not able to make CMake to do the right thing.

Anyways, it would be nice if we could have the Windows libs along with the executable similar to the other platforms.

Originally created by @buletti on GitHub (Sep 29, 2017). Hi, would it be possible to include the .dll files in the binary downloads for Windows? The .dlls are kind of needed to make the JNI wrappers work. This is especially a problem for the encoder as there is no Java implementation (which is a huge adoption problem IMHO). I already tried to build the .dlls myself with CMake and MinGW, but I was not able to make the JNI encoder wrapper work with them. I always got an UnsatisfiedLinkError on instantiation with libbrotlicommon.dll and libbrotlienc.dll loaded. >java.lang.UnsatisfiedLinkError: org.brotli.wrapper.enc.EncoderJNI.nativeCreate([J)Ljava/nio/ByteBuffer; at org.brotli.wrapper.enc.EncoderJNI.nativeCreate(Native Method) at org.brotli.wrapper.enc.EncoderJNI.access$000(EncoderJNI.java:15) at org.brotli.wrapper.enc.EncoderJNI$Wrapper.<init>(EncoderJNI.java:36) at org.brotli.wrapper.enc.Encoder.compress(Encoder.java:159) at org.brotli.wrapper.enc.Encoder.compress(Encoder.java:196) I suspect it has to do with [gcc using symbols incompatible with JNI](https://stackoverflow.com/questions/10274278/jni-unsatisfiedlinkerror-on-native-method) and me not able to make CMake to do the right thing. Anyways, it would be nice if we could have the Windows libs along with the executable similar to the other platforms.
Author
Owner

@eustas commented on GitHub (Sep 29, 2017):

Going to investigate and extend binary downloads soon.
Yes, JNI is always a pain.
Bazel was a big hope, as it, at least, works both on OSX and linux (still not on windows)... but even on those platforms, JNI requires hacks: https://github.com/bazelbuild/bazel/issues/3079

@eustas commented on GitHub (Sep 29, 2017): Going to investigate and extend binary downloads soon. Yes, JNI is always a pain. Bazel was a big hope, as it, at least, works both on OSX and linux (still not on windows)... but even on those platforms, JNI requires hacks: https://github.com/bazelbuild/bazel/issues/3079
Author
Owner

@eustas commented on GitHub (Oct 9, 2017):

Working on this.
In the meanwhile, just to be sure: have you built jni library, or just brotli common/dec/enc libraries? Currently only Bazel builds it, so CMake/premake/make is not enough...

@eustas commented on GitHub (Oct 9, 2017): Working on this. In the meanwhile, just to be sure: have you built jni library, or just brotli common/dec/enc libraries? Currently only Bazel builds it, so CMake/premake/make is not enough...
Author
Owner

@buletti commented on GitHub (Oct 9, 2017):

I was not using Bazel. I was basically just following the build instructions of the readme.md for CMake.
I got the following .dlls as a result:

  • libbrotlicommon.dll
  • libbrotlidec.dll
  • libbrotlienc.dll

However, when the JNI calls to those .dlls failed with the above UnsatisfiedLinkError I tried to add
CMAKE_CXX_FLAGS=-D_JNI_IMPLEMENTATION_ -Wl,--kill-at
and to include the JAVA headers
CMAKE_CXX_STANDARD_LIBRARIES=-I %JAVA_HOME%\include -I %JAVA_HOME%\include\win32
Anyways the result was the same.

Thank you very much for looking into the matter.

@buletti commented on GitHub (Oct 9, 2017): I was not using Bazel. I was basically just following the build instructions of the readme.md for CMake. I got the following .dlls as a result: - libbrotlicommon.dll - libbrotlidec.dll - libbrotlienc.dll However, when the JNI calls to those .dlls failed with the above `UnsatisfiedLinkError` I tried to add `CMAKE_CXX_FLAGS=-D_JNI_IMPLEMENTATION_ -Wl,--kill-at` and to include the JAVA headers `CMAKE_CXX_STANDARD_LIBRARIES=-I %JAVA_HOME%\include -I %JAVA_HOME%\include\win32` Anyways the result was the same. Thank you very much for looking into the matter.
Author
Owner

@eustas commented on GitHub (Oct 10, 2017):

Those libraries are not enough. Going to add "all-in-one" statically linked brotli_jni.dll as soon as convince bazel to run tests properly on Appveyor.

@eustas commented on GitHub (Oct 10, 2017): Those libraries are not enough. Going to add "all-in-one" statically linked `brotli_jni.dll` as soon as convince bazel to run tests properly on Appveyor.
Author
Owner

@eustas commented on GitHub (Oct 11, 2017):

PR #612 adds brotli_jni.dll publishing.

@eustas commented on GitHub (Oct 11, 2017): PR #612 adds brotli_jni.dll publishing.
Author
Owner

@eustas commented on GitHub (Oct 12, 2017):

Could you try if this precompiled brotli_jni.dll works for you, please. Thanks.

@eustas commented on GitHub (Oct 12, 2017): Could you try if this precompiled [brotli_jni.dll](https://bintray.com/eustas/brotli/download_file?file_path=brotli-win-bazel-jni-2017-10-11.zip) works for you, please. Thanks.
Author
Owner

@buletti commented on GitHub (Oct 13, 2017):

Yep, seems to work fine. Thanks!

@buletti commented on GitHub (Oct 13, 2017): Yep, seems to work fine. Thanks!
Author
Owner

@buletti commented on GitHub (Oct 13, 2017):

Another quick question: I don't see JNI builds for platforms other than Windows at bintray:
Do other platforms not need separate JNI libraries? E.g. can I use libbrotlicommon.so + libbrotlienc.so on Linux for JNI calls to the encoder?

@buletti commented on GitHub (Oct 13, 2017): Another quick question: I don't see JNI builds for platforms other than Windows at [bintray](https://bintray.com/eustas/brotli/bin#files): Do other platforms not need separate JNI libraries? E.g. can I use `libbrotlicommon.so` + `libbrotlienc.so` on Linux for JNI calls to the encoder?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#196