Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
istinnstudio opened this issue Mar 7, 2022 · 10 comments

Comments

@istinnstudio
Copy link

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

@tonsky
Copy link
Contributor

tonsky commented Mar 7, 2022

Are you by any chance on non-x86_64 architecture?

@istinnstudio
Copy link
Author

istinnstudio commented Mar 7, 2022

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?

@tonsky
Copy link
Contributor

tonsky commented Mar 7, 2022

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?

@istinnstudio
Copy link
Author

istinnstudio commented Mar 7, 2022

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
Copy link
Author

istinnstudio commented Mar 8, 2022

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
Copy link
Author

@istinnstudio
Copy link
Author

istinnstudio commented Mar 19, 2022

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

@tonsky
Copy link
Contributor

tonsky commented Mar 19, 2022

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

@0-x-2-2
Copy link

0-x-2-2 commented May 27, 2022

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.

@istinnstudio
Copy link
Author

istinnstudio commented Dec 28, 2022

After upgrading to windows10 from 7 have realized that the restriction is not only the OS but the hardware also.
If your hardware doesn't support dx12, there is no way to use skija.

I am not sure about the requirements for openGL, but if an automated new "windows dll" build could be managed in the github action system with Direct3d disabled could be a useful addition. At least we could build here if possible, just a test dll for openGL only hardware..
I have tried to build it locally without success. If someone knows how to do this, that would be awesome.

Testing 0.109 with skijaGraphics2D graphics2d-tester actually works
and produces the test image, a guess is that the dll takes place on drawing pixels on screen (canvas in skia?), and the skijaGraphics2D parser at the end does not need dll to work by design, final objects are being translated to Graphics2D.

# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd4d47cbd0, pid=17668, tid=16644
...

... log


---------------  T H R E A D  ---------------

Current thread (0x00000206ed422160):  JavaThread "main" [_thread_in_vm, id=16644, stack(0x0000003a3ab00000,0x0000003a3ac00000)]

Stack: [0x0000003a3ab00000,0x0000003a3ac00000],  sp=0x0000003a3abfe288,  free space=1016k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0x1cbd0]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  io.github.humbleui.skija.impl.Library._nAfterLoad()V+0
j  io.github.humbleui.skija.impl.Library.load()V+285
j  io.github.humbleui.skija.impl.Library.staticLoad()V+19
j  io.github.humbleui.skija.Surface.<clinit>()V+16
v  ~StubRoutines::call_stub
j  com.jan.skija.SkijaTestingWiki.<init>()V+16
j  com.jan.skija.SkijaTestingWiki.main([Ljava/lang/String;)V+19
v  ~StubRoutines::call_stub

siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0x0000000000000000


Register to memory mapping:

RIP=0x00007ffd4d47cbd0 jvm.dll
RAX=0x0000000800456798 is pointing into metadata
RBX=0x0000000800453c08 is pointing into metadata
RCX=0x0 is NULL
RDX=0x00007ff574462c9e is an unknown value
RSP=0x0000003a3abfe288 is pointing into the stack for thread: 0x00000206ed422160
RBP=0x00007ffd748b943c skija.dll
RSI=0x0 is NULL
RDI=0x0000000800456798 is pointing into metadata
R8 =0x0 is NULL
R9 =0x0000000000000005 is an unknown value
R10=0x0 is NULL
R11=0x0000003a3abfe258 is pointing into the stack for thread: 0x00000206ed422160
R12=0x00007ffd748b9444 skija.dll
R13=0x00000206ed422160 is a thread
R14=0x00007ffd748b943c skija.dll
R15=0x0 is NULL

...



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants