Skip to content

Missing native library for Alpine Linux (Linux-Alpine) in v0.10.1 #303

Description

@HennyWilly

OS: Alpine Linux 3.21.3 (Docker)
Java: 21 (Amazon Corretto)
Library version: 0.10.1

On version 0.10.1, I get the following error when trying to load a WebP image:

java.lang.IllegalStateException: No native library found for os.name=Linux-Alpine, os.arch=x86_64, paths=[/opt/java/corretto/lib/server:/opt/java/corretto/lib:/opt/java/corretto/../lib:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
  at com.luciad.imageio.webp.internal.NativeLoader.loadNativeLibrary(NativeLoader.kt:226)
  at com.luciad.imageio.webp.internal.NativeLoader.initialize(NativeLoader.kt:62)
  at com.luciad.imageio.webp.WebPWrapper.loadNativeLibrary(WebPWrapper.kt:31)
  at com.luciad.imageio.webp.WebPWrapper.<clinit>(WebPWrapper.kt:24)
  at com.luciad.imageio.webp.WebPReadParam.<clinit>(WebPReadParam.kt:83)
  at com.luciad.imageio.webp.WebPReader.getDefaultReadParam(WebPReader.kt:117)
  at com.luciad.imageio.webp.WebPReader.getDefaultReadParam(WebPReader.kt:36)
 [...]

The cause appears to be that the NativeLoader is now looking for a native .so file in the folder /native/Linux-Alpine/x86_64, which does not exist inside the JAR.
Before PR #292, Alpine was not correctly detected and /native/Linux/x86_64 was used instead. AFAIK, the .so file there appears the be compatible with musl, at least in my case.

My suggestions:

  • Could you consider adding the .so binaries for Alpine (/native/Linux-Alpine/...)?
  • Alternatively, would it make sense to implement a fallback resolution (e.g., try /native/Linux/... if /native/Linux-Alpine/... is not found)?

Thanks for your work on this library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions