JetBrains / skija

Java bindings for Skia
Apache License 2.0
2.63k stars 127 forks source link

UnsatisfiedLinkError on Linux on a hosted server #144

Closed jonasbark closed 2 years ago

jonasbark commented 2 years ago

The dependency used: org.jetbrains.skija:skija-linux:0.93.1

Full stracktrace:

java.lang.UnsatisfiedLinkError: /tmp/skija_0.93.1/libskija.so: libGL.so.1: cannot open shared object file at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
No such file or directory
java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method) (0)
java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2445) (0)
java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2501) (0)
java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2700) (0)
java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2630) (0)
java.base/java.lang.Runtime.load0(Runtime.java:768) (0)
java.base/java.lang.System.load(System.java:1837) (0)
org.jetbrains.skija.impl.Library.load(Library.java:77) (0)
org.jetbrains.skija.impl.Library.staticLoad(Library.java:47) (0)
org.jetbrains.skija.Surface.<clinit>(Surface.java:9) (0)
***
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) (0)
kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) (0)
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) (0)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) (0)

It happens on an Azure App Service that's on a Linux App Service Plan. It runs the following docker image:

FROM azul/zulu-openjdk:11
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ADD https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.2.3/applicationinsights-agent-3.2.3.jar .

ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} app.jar

ENTRYPOINT ["java","-javaagent:applicationinsights-agent-3.2.3.jar","-jar","app.jar"]

I inspected the app.jar and it contains skija-linux-0.93.1.jar and in it the libskija.so (built on 11. of August 2021)

jonasbark commented 2 years ago

Welllll... should've read that error message more carefully.

Fixed by adding RUN apt-get update && apt-get install -y --no-install-recommends libgl1 libglib2.0-0 to the Dockerfile