Skija icon indicating copy to clipboard operation
Skija copied to clipboard

Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load ... skija.dll

Open istinnstudio opened this issue 2 years ago • 10 comments

Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load C:\Users\...\AppData\Local\Temp\skija_0.100.0\skija.dll
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:1793)
	at java.base/java.lang.System.load(System.java:672)
	at io.github.humbleui.skija.impl.Library.load(Library.java:73)
	at io.github.humbleui.skija.impl.Library.staticLoad(Library.java:47)
	at io.github.humbleui.skija.Surface.<clinit>(Surface.java:10)
	...

same error when using System.load(), System.loadLibrary(), System.setProperty() etc. windows, netbeans, pre-compiled skija 0.100, skija.dll icudtl.dat files EXTRACTED OK in temp dir any ideas on how to get it loaded?

Seems like a great project! thanks

istinnstudio avatar Mar 07 '22 02:03 istinnstudio

Are you by any chance on non-x86_64 architecture?

tonsky avatar Mar 07 '22 14:03 tonsky

x64 but win7 (!), netbeans 12.5, java17, Semeru IBM Runtimes (openj9), could it be win7 OS related? is there any internal dependency that needs something newer like maybe directX12 or something?

istinnstudio avatar Mar 07 '22 19:03 istinnstudio

We do link with DX12, I believe. Not sure if it matters if you are only using OpenGL backend, but problem here seems to happen way earlier, when library is loaded.

We build on Windows 10, too, maybe this is the reason?

tonsky avatar Mar 07 '22 20:03 tonsky

I see, unfortunately I cannot test it in an other system at the moment, I will report back if it will happen. dll info shows:

OPENGL32.dll
    wglGetProcAddress
      Ordinal:   0x0163
      Address:   0x008DEE08
      Delayed:   NO
    wglGetCurrentContext
      Ordinal:   0x015E
      Address:   0x008DEDF0
      Delayed:   NO

d3d12.dll
    D3D12SerializeRootSignature
      Ordinal:   0x000E
      Address:   0x008DF132
      Delayed:   NO

  D3DCOMPILER_47.dll
    D3DCompile
      Ordinal:   0x0001
      Address:   0x008DF15A
      Delayed:   NO

....USER32.dll, KERNEL32.dll

Not sure if this is the case either. I would expect a more informative error, not this simple "Can't load". I guess it is deeper, an idea would be to recompile skija.dll without d3d12 (openGL only) or compile against d3d11 if applicable. I am not familiar with the needed C++ dev environment. So lets forget it at the moment, but if you are by chance interested and it is relatively easy for you to make a special dll, I could test it and report my results. We keep in mind that many older GPUs only support dx11, and win7 only supports dx11 natively. Only special games with the related drivers and new GPUs can load dx12 from win7. But we still do not know if this is the case. https://devblogs.microsoft.com/directx/porting-directx-12-games-to-windows-7/

istinnstudio avatar Mar 07 '22 20:03 istinnstudio

The message from an alternative jvm. Now it is "Can't find dependent libraries"

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: C:\Users\...\AppData\Local\Temp\skija_0.100.0\skija.dll: Can't find dependent libraries
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
	at java.base/java.lang.Runtime.load0(Runtime.java:755)
	at java.base/java.lang.System.load(System.java:1953)
	at io.github.humbleui.skija.impl.Library.load(Library.java:73)
	at io.github.humbleui.skija.impl.Library.staticLoad(Library.java:47)
	at io.github.humbleui.skija.Surface.<clinit>(Surface.java:10)

istinnstudio avatar Mar 08 '22 13:03 istinnstudio

https://skia.org/docs/user/special/angle/ https://groups.google.com/g/skia-discuss/c/TGBzojV7Ygs/m/TDWDgOZPCQAJ?utm_medium=email&utm_source=footer

I guess there could be a build for older GPUs based on dx11

istinnstudio avatar Mar 11 '22 00:03 istinnstudio

update: The project https://github.com/micycle1/processing-skia loads its bundled skija dll OK, the version for windows linked at the releases page here: https://github.com/micycle1/processing-skia/releases/ the bundled version is 0.90 a version with a time stamp 20/4/2021 1:44:34 The dlls if switched we get different error

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: 'void io.github.humbleui.skija.impl.Library._nAfterLoad()'
	at io.github.humbleui.skija.impl.Library._nAfterLoad(Native Method)
	at io.github.humbleui.skija.impl.Library.load(Library.java:108)
	at io.github.humbleui.skija.impl.Library.staticLoad(Library.java:47)
	at io.github.humbleui.skija.Surface.<clinit>(Surface.java:10)

The old dll does not import the D3D 12 dependency and loads OK. So as far as I can test those dependencies are the problem. It will be very useful if there could be a dll release based on open OpenGL only in order to prevent this incompatibility with GPUs/hardware that do not support D3D 12. OpenGL seems compatible with more systems. So we could change this as a Feature Request. image

istinnstudio avatar Mar 19 '22 03:03 istinnstudio

Just replacing Skia DLL won’t work, Skija adds a translation layer (which is also in C++) to it.

I’d like to help you out but honestly Windows 7 is quite a low priority right now. Microsoft stopped supporting it 7 years ago. We don’t have infinite resources, and have to focus our effort on what benefits the most people.

Projecting into the future, needing a separate Windows 7 machine just to test this could also become a problem.

My suggestion is that you build Skia and Skija yourself. It shouldn’t be that hard, start by trying to turn off this flag https://github.com/HumbleUI/SkiaBuild/blob/37a6b6018a5a94ce8e118e09d2f4f7adbb06a4c3/script/build.py#L61

tonsky avatar Mar 19 '22 18:03 tonsky

Note that it is possible to use DirectX12 on Windows 7 but it does not come with the operating system by default. https://github.com/microsoft/DirectX-Graphics-Samples/tree/develop/Samples/Desktop/D3D12On7

Not sure if this requires linking separately or if the distributed binaries just work.

0-x-2-2 avatar May 27 '22 02:05 0-x-2-2