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

java.lang.UnsatisfiedLinkError: dlopen failed: library "libkompute-jni.so" not found #125

Closed
PascalPolygon opened this issue Jan 28, 2021 · 11 comments

Comments

@PascalPolygon
Copy link

PascalPolygon commented Jan 28, 2021

Hello, I am following the following tutorial: https://towardsdatascience.com/gpu-accelerated-machine-learning-in-your-mobile-applications-using-the-android-ndk-vulkan-kompute-1e9da37b7617. I am running ubuntu 20 and whenever I run the emulator I get the following error.

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.ethicalml.kompute, PID: 14488 java.lang.UnsatisfiedLinkError: dlopen failed: library "libkompute-jni.so" not found at java.lang.Runtime.loadLibrary0(Runtime.java:1087) at java.lang.Runtime.loadLibrary0(Runtime.java:1008) at java.lang.System.loadLibrary(System.java:1664) at com.ethicalml.kompute.KomputeJni.<clinit>(KomputeJni.kt:80) at java.lang.Class.newInstance(Native Method) at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95) at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:41) at android.app.Instrumentation.newActivity(Instrumentation.java:1253) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3353) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) I/Process: Sending signal. PID: 14488 SIG: 9

@axsaucedo
Copy link
Member

This could be many reasons but the most probably would be due to the emulator not supporting Vulkan, which phone are you emulating this on?

@PascalPolygon
Copy link
Author

Pixel 2 w API 30. That's the same you used in the tutorial right?

@axsaucedo
Copy link
Member

Hmm strange - a couple of questions:

  • do you have the Vulkan SDK installed?
  • could you try with a different emulator like Pixel XL?
  • Are you trying to run the example exactly as provided (in the repo under examples/android) or with differences?

@PascalPolygon
Copy link
Author

Thanks for the responses.
Is there a specific installation step for the Vulkan SDK? I assumed that cloning and running the demo as is would have all the dependencies. I am trying to run it as is.

@axsaucedo
Copy link
Member

I am looking at the documentation in the Android NDK and strangely I can't really see an explicit step where it requires installing the Vulkan SDK. I assumed that it would be a requirement as it comes will all the relevant libraries, but it may be the case that in the emulator the Vulkan interface is actually abstracted / mocked as well (although from the error you are getting it clearly does need the library). I can't really tell, but I would suggest those steps above initially, namely testing with that emulator, and if not installing the SDK. The installation of the Vulkan SDK is quite straightforward, it can be found in the official website https://vulkan.lunarg.com/

@axsaucedo
Copy link
Member

@PascalPolygon did this get resolved?

@axsaucedo
Copy link
Member

Closing for inactivity, reopen if still an issue with latest version

@mariaRoxana94
Copy link

mariaRoxana94 commented Jun 22, 2021

Hello! I have the same issue as above. Can someone tell me what was the solution? I'm running the project without any changes on windows 10 and I m using the lastest version of android studio and NDK. I tried on different versions of emulator from android studio, including Pixel XL. Thx in advance!
Android

@axsaucedo
Copy link
Member

It seems the JNI is not properly building for you, do you see any erros on the CMAKE?

@mariaRoxana94
Copy link

mariaRoxana94 commented Jun 23, 2021

I opened from vulkan-compute just the android-simple with android studio, not the whole project vulkan-compute.
The only errors are these, at the build in the Sync tab:

Android

can you tell, please, if you did a special configuration into androidstudio to run this project?

@axsaucedo
Copy link
Member

Just gave it a try and couldn't see any issues, updated to the latest android studio as well. I don't think there was any particualr configuration - there is quite a lot of options on the IDE, so would be a bit of an exploration to get it running, but can confirm it's working:

image

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

No branches or pull requests

3 participants