sejda-pdf / webp-imageio

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

Windows 10 not finding DLL in JAR file. #1

Closed mcpierce closed 4 years ago

mcpierce commented 4 years ago

I'm the project lead for ComiXed.

We're using your library to process WebP encoded comic pages. On Mac no issues have been reported. However some Windows users have reported a bug when working with WebP images (see the thread here for the details - comixed/comixed#159):

Exception in thread "Jarvis-ComiXed" java.lang.UnsatisfiedLinkError: C:\Users\<user>\AppData\Local\Temp\8794223231485648063webp-imageio.dll: Can't find dependent libraries
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(Unknown Source)
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.load0(Unknown Source)
        at java.lang.System.load(Unknown Source)
        at com.luciad.imageio.webp.NativeLibraryUtils.loadFromJar(WebP.java:131)
        at com.luciad.imageio.webp.WebP.loadNativeLibrary(WebP.java:31)
        at com.luciad.imageio.webp.WebP.<clinit>(WebP.java:38)
        at com.luciad.imageio.webp.WebPDecoderOptions.<clinit>(WebPDecoderOptions.java:20)
        at com.luciad.imageio.webp.WebPReadParam.<init>(WebPReadParam.java:24)
        at com.luciad.imageio.webp.WebPReader.getDefaultReadParam(WebPReader.java:147)
        at javax.imageio.ImageIO.read(Unknown Source)
        at javax.imageio.ImageIO.read(Unknown Source)
        at org.comixed.model.library.Page.getImageMetrics(Page.java:145)
        at org.comixed.model.library.Page.<init>(Page.java:120)
        at org.comixed.loaders.ImageEntryLoader.loadContent(ImageEntryLoader.java:45)
        at org.comixed.adaptors.archive.AbstractArchiveAdaptor.processContent(AbstractArchiveAdaptor.java:211)
        at org.comixed.adaptors.archive.ZipArchiveAdaptor.loadAllFiles(ZipArchiveAdaptor.java:90)
        at org.comixed.adaptors.archive.ZipArchiveAdaptor.loadAllFiles(ZipArchiveAdaptor.java:45)
        at org.comixed.adaptors.archive.AbstractArchiveAdaptor.loadComic(AbstractArchiveAdaptor.java:138)
        at org.comixed.task.model.ProcessComicTask.startTask(ProcessComicTask.java:60)
        at org.comixed.task.runner.Worker.run(Worker.java:187)
        at java.lang.Thread.run(Unknown Source)

We're using the 1.0 release from Maven of webp-imageio.

bareheiny commented 4 years ago

A bit more info (I'm one of the users with issues on Windows).

This has occurred on two machines - both running 64bit Win 10 Pro. I reset one of my machines (for unrelated reasons) and reinstalled Java SE 1.8.0_241.

I tried CX again, and got a completely different set of errors than the missing library ones, but didn't capture a log.

Now I get the missing library error again.

ediweissmann commented 4 years ago

Thanks for the bug report! Tests seem to fail on Windows 10, but seem to pass on Windows 10 when VS2017 build tools installed.

I think maybe the compiled webp-imageio.dll has a dependency that is not present on Windows 10 by default.

mcpierce commented 4 years ago

@ediweissmann My Windows fu is pretty weak, but is there a command line tool to do that? Similar to the tools available on *nix systems to get the list of immediate dependencies for a shared library?

dukeofradish commented 4 years ago

@mcpierce The tool you want is Dependencies. https://github.com/lucasg/Dependencies Running that across the webp-imageio.dll showed a missing dependency for 'ucrtbased.dll'. That DLL is installed with the VS2017 Build Tools Windows 10 SDK.

After installing that DLL webp comics import properly. webp-dependency

bareheiny commented 4 years ago

On a 64bit Win 10 Surface Pro 4, I'm seeing VCRUNTIME140D.dll as missing as well.

ediweissmann commented 4 years ago

I'll be looking into going the static library route to avoid these problems.

coder111111 commented 4 years ago

Hi, I've hit this problem as well and this prevents me from progressing. Could you please get this fixed soon?

gondur commented 4 years ago

Hi i think the core of this problem is, that the webP DLL was compiled as DEBUG build (therefore linking to the debug DLLs) while it should be build as RELEASE build, then it would link against the usually available DLLs on Windows' and c++ redistributable libs.

ediweissmann commented 4 years ago

You're right gondur, that seems to be the root cause of the problem. If I build as RELEASE build it works on a clean Windows 10.

Thanks!

I'll make a release tomorrow.

ediweissmann commented 4 years ago

Fixed in 0.1.2

coder111111 commented 4 years ago

Hello,

Are you going to publish the binaries for this release to Maven Central? I also cannot see a tag for this release in your repo.

Thanks for quick response on fixing this.

Sincerely, --Coder

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Thursday, April 23, 2020 2:51 PM, Edi Weissmann notifications@github.com wrote:

Fixed in 0.1.2

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

ediweissmann commented 4 years ago

Should be published now, under: org.sejda.imageio:webp-imageio:0.1.2