go-webgpu
go-webgpu copied to clipboard
Provide .so file for Android
Hello, can you provide .so file in Artifacts, i see your Github Action have compiled a .so file, but not copy to final Artifacts. I'm a xamarin developer, it can't directly load static library, only support dynamic library, i try to convert .a to .so, but generate some error, so hope you can provide it directly.
Is there a reason you are using go-webgpu in a xamarin app and not directly using wgpu-native
?
You can get .so of wgpu-native
from artifacts section of cd.yml github action.
go-webgpu
is just a wrapper library around wgpu-native
for exposing WebGPU API in Go.
Oh you need android .so
of wgpu-native
for xamarin project, unfortunately I can't include them in this repo because it will unnecessarily increase the repo size (it's already around 400MB).
Though you should be able to build it locally using this script.
Or you can just fork this repo and change this line to copy .so
file instead of .a
, and run the action from your forked repo.
Thank you, i will try. I have another question, why all your .a files very big, i see wgpu-native/releases all .dll and .so <10m, have different params when build?
no special build flags it's just that static libs tend to be big, it's normal
Hello, i use your Github Action compiled dynamic library , but get some error when use it in Xamarin.
When i load it by C# on android, throw DllNotFoundException,
[monodroid-assembly] Shared library 'libwgpunative.so' not loaded, p/invoke 'wgpuCreateInstance' may fail
I try use System.loadLibrary
of Java on android, show exception:
Java.Lang.UnsatisfiedLinkError:** 'dlopen failed: cannot locate symbol "ANativeWindow_setBuffersGeometry" referenced by "/data/app/com.companyname.WgpuAndroidApp-xtoQrCgMf64RV0nZ4m8B1w==/lib/x86_64/libwgpunative.so"...'
I Google it, find have a method to solve it, do you know it needs to have -lnativewindow added to its link command
what mean?
[monodroid-assembly] Shared library 'libwgpunative.so' not loaded, p/invoke 'wgpuCreateInstance' may fail
it's wgpu-native
issue many functions listed in header files aren't actually implemented & exported, including wgpuCreateInstance
.
Java.Lang.UnsatisfiedLinkError:** 'dlopen failed: cannot locate symbol "ANativeWindow_setBuffersGeometry" referenced by "/data/app/com.companyname.WgpuAndroidApp-xtoQrCgMf64RV0nZ4m8B1w==/lib/x86_64/libwgpunative.so"...'
you probably need to load libandroid.so
before loading wgpu library
I have try
Java.Lang.JavaSystem.LoadLibrary("android");
Java.Lang.JavaSystem.LoadLibrary("nativewindow");
but don't solve it, according https://github.com/xamarin/xamarin-android/issues/6765#issuecomment-1041464888, first i need to do it needs to have -lnativewindow added to its link command
, i search github only find set it in Android.mk, i don't know how to do it in this rust project.
you can change this line like:
- export RUSTFLAGS="-L $PWD/tmp-lib"
+ export RUSTFLAGS="-L $PWD/tmp-lib -C link-args=-landroid"
also don't think you'd need to link libnativewindow.so
just libandroid.so
should be enough