sejda-pdf / webp-imageio

Java ImageIO WebP support
Apache License 2.0
198 stars 74 forks source link

other architecture compatibility? #5

Open gotson opened 3 years ago

gotson commented 3 years ago

Hello,

is this compatible with ARM32/64 ?

ediweissmann commented 3 years ago

Have not tested, I doubt it.

gotson commented 3 years ago

What would it take to make it compatible? I didn't check in details, do you pull the compiled native libraries from somewhere else or do you build them yourself?

gotson commented 3 years ago

I have been working on that and managed to get some results.

I have looked at how https://github.com/xerial/sqlite-jdbc does the cross-compilation for multiple OS and Architectures. It uses https://github.com/dockcross/dockcross mostly. That project is using make instead of cmake, so i tried to make it work using cmake, which is a bit more complex to handle especially for libwebp.

I managed to cross-compile for multiple Linux architectures. I have successfully tested the Linux Arm64 on Travis.

My Windows builds are failing however, the DLL is built, but Travis fails and i don't know why.

For Mac i could not make the cross compilation work, and even the one i compiled on my Mac after changing slightly the cmake instructions are failing on Travis.

I also changed the library loader to use the one from sqlite-jdbc, which handles better the various architectures.

From what i understand, this project uses manually built libraries for now? If that's the case, would you be open to a PR that would involve:

libwebp doesn't seem to be updated that often, so if a new one is released i could recompile the Linux flavors.

FYI the problem i have with cross-compiling was the absence of JDK in the docker images, so cmake failed to import the JNI headers. I have added the JNI headers manually in the project (they don't change often), and added a dependency manually.

gotson commented 3 years ago

I found out why my Mac libraries where failing tests. I am using Mac 10.15, and there's a special parameter to use in cmake to compile for older version (there's one in the cmake script but it doesn't work). However I can only compile down to 10.9, but I don't know about the existing dylib. On Travis i could set up some Mac vms down to 10.11 which is the lowest one they have.

I'll try to get the cross compilation working for Mac and windows.

gotson commented 3 years ago

After another day of work, i managed to fix the cross-compilation using Docker for both Windows and Mac. The good news is that the Mac SDK in the docker image is 10.10, and can compile down to 10.5, which is what was set in the project CMake file.

I now have cross-build for (in bold the new ones compared to master):

It would also simplify the build process of the native libs when upgrading the version of libwebp, not having to depend on multiple physical machines to compile for the various architectures.

I have also added more builds in Travis, see here: https://travis-ci.com/github/gotson/webp-imageio/builds/177412664

I would like to add some jobs for the Linux builds using other architecture, but I didn't manage to do so yet. It should be possible using multiarch/qemu-user-static.

namero999 commented 2 years ago

Hey @gotson is this a custom build, or is it somehow possible to pull from maven repo a version of this lib that includes an aarch64 binary as well? Got a CI running on ARM and would like to see all the tests pass there as well.

namero999 commented 2 years ago

Oh, I've found your fork of the library on maven central (same username). Thanks a lot!

gotson commented 2 years ago

yes, see here

kaiwidmann commented 1 month ago

Hello there,

in September 2023 there was a security issue discovered in libwebp: https://snyk.io/de/blog/critical-webp-0-day-cve-2023-4863/

Is there a way to rebuild the libs for the different architectures for the current version of libwebp (1.4)? I tried to do it myself, but I failed on Apple silicone. Any help or response would be very appreciated.

Cheers,

Kai