[Tensorflow Lite] libtask_vision_jni.so crashes on Windows Subsystem for Android
@ammargitham just curious if you know where `task_vision_jni` is being added to the dependency? I assumed it was a system library. When I try to use GPU `BaseOptions.builder().useGpu().build()` as referenced [here](https://www.tensorflow.org/lite/android/delegates/gpu_task#:~:text=BaseOptions.builder().useGpu().build()%3B) i'm getting error: `Error occurred when initializing ObjectDetector: ModifyGraphWithDelegate() failed for delegate 'GPU'.` and `Error getting native address of native library: task_vision_jni` 

No idea if I'm missing any dependency. I see you have the reference to the library in your logs, wondering if you know what might be causing this behavior?   @bhimeshchauhan I have exactly those libs mentioned in the original post. `task_vision_jni` is coming from `tflite-task-vision` I suppose. Anyway, this ticket is related to the crash on Windows Subsystem for Android. Are trying your code on that? 
>@ammargitham just curious if you know where `task_vision_jni` is being added to the dependency? I assumed it was a system library. When I try to use GPU `BaseOptions.builder().useGpu().build()` as referenced [here](https://www.tensorflow.org/lite/android/delegates/gpu_task#:~:text=BaseOptions.builder().useGpu().build()%3B) i'm getting error: `Error occurred when initializing ObjectDetector: ModifyGraphWithDelegate() failed for delegate 'GPU'.` and `Error getting native address of native library: task_vision_jni`  ...

@bhimeshchauhan #62735 

<sub>Sent with <a href="http://githawk.com">GitHawk</a></sub> 
> ...

@davidmerwin 

<sub>Sent with <a href="http://githawk.com">GitHawk</a></sub>
<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

No

### Source

binary

### Tensorflow Version

tflite-gpu: 2.12.0, tflite-gpu-delegate-plugin: 0.4.3, tflite-task-vision: 0.4.3

### Custom Code

Yes

### OS Platform and Distribution

Windows Subsystem for Android

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

ObjectDetector.detect crashes on Windows Subsystem for Android. Works fine on Android Emulator and physical devices.

### Standalone code to reproduce the issue

```shell
// Tried nnapi, gpu and default (cpu)

val baseOptions = BaseOptions.builder().apply {
    // useNnapi()
    if (CompatibilityList().isDelegateSupportedOnThisDevice) {
        useGpu()
    }
}.build()
val objectDetectorOptions = ObjectDetector.ObjectDetectorOptions.builder().apply {
    setBaseOptions(baseOptions)
    setScoreThreshold(0.2f)
    setMaxResults(5)
}.build()

val tensorImage = ...
val objectDetector = ObjectDetector.createFromFileAndOptions(
    model, // used EfficientDet-Lite0
    objectDetectorOptions,
)
val detections = objectDetector.detect(tensorImage)
```


### Relevant log output

```shell
Fatal signal 11 (SIGSEGV), code 128 (SI_KERNEL), fault addr 0x0 in tid 9070 (DefaultDispatch), pid 9007 (mmar.havenwalls)
23:23:26.791 DEBUG              E  failed to readlink /proc/9070/fd/167: No such file or directory
23:23:26.799 crash_dump64       I  obtaining output fd from tombstoned, type: kDebuggerdTombstoneProto
23:23:26.799 tombstoned         I  received crash request for pid 9070
23:23:26.799 crash_dump64       I  performing dump of process 9007 (target tid = 9070)
23:23:26.896 DEBUG              A  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
23:23:26.896 DEBUG              A  Build fingerprint: 'Windows/windows_x86_64/windows_x86_64:13/TQ2A.230305.008.C1/2303.40000.5.0:user/release-keys'
23:23:26.896 DEBUG              A  Revision: '0'
23:23:26.896 DEBUG              A  ABI: 'x86_64'
23:23:26.896 DEBUG              A  Timestamp: 2023-05-02 23:23:26.802005135+0900
23:23:26.896 DEBUG              A  Process uptime: 15s
23:23:26.896 DEBUG              A  Cmdline: com.ammar.havenwalls
23:23:26.896 DEBUG              A  pid: 9007, tid: 9070, name: DefaultDispatch  >>> com.ammar.havenwalls <<<
23:23:26.896 DEBUG              A  uid: 10069
23:23:26.896 DEBUG              A  signal 11 (SIGSEGV), code 128 (SI_KERNEL), fault addr 0x0000000000000000
23:23:26.896 DEBUG              A      rax 00007f0cedffabc0  rbx 00007f0e8ce1d0e0  rcx 00007f0e8ce1d120  rdx 00007f0cedffabc0
23:23:26.896 DEBUG              A      r8  00007f0e8ce1d0e0  r9  0000000000000003  r10 0000000000000003  r11 00007f0cefd1bff0
23:23:26.896 DEBUG              A      r12 0000000000012c18  r13 00007f0cee540000  r14 0000000000000000  r15 0000000000000000
23:23:26.896 DEBUG              A      rdi 0000000000012c18  rsi 00007f0cedb08b80
23:23:26.896 DEBUG              A      rbp 00007f0cf0ed8870  rsp 00007f0cf0ed8870  rip 00007f0cee527288
23:23:26.896 DEBUG              A  backtrace:
23:23:26.896 DEBUG              A        #00 pc 0000000000495288  /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/lib/x86_64/libtask_vision_jni.so
23:23:26.896 DEBUG              A        #01 pc 00000000004ae031  /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/lib/x86_64/libtask_vision_jni.so
23:23:26.896 DEBUG              A        #02 pc 00000000004e719f  /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/lib/x86_64/libtask_vision_jni.so
23:23:26.896 DEBUG              A        #03 pc 00000000004ae2b4  /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/lib/x86_64/libtask_vision_jni.so
23:23:26.896 DEBUG              A        #04 pc 000000000049b315  /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/lib/x86_64/libtask_vision_jni.so
23:23:26.896 DEBUG              A        #05 pc 000000000041b6a9  /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/lib/x86_64/libtask_vision_jni.so
23:23:26.896 DEBUG              A        #06 pc 000000000053767a  /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/lib/x86_64/libtask_vision_jni.so
23:23:26.896 DEBUG              A        #07 pc 00000000005294eb  /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/lib/x86_64/libtask_vision_jni.so
23:23:26.896 DEBUG              A        #08 pc 00000000004fbea4  /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/lib/x86_64/libtask_vision_jni.so
23:23:26.896 DEBUG              A        #09 pc 000000000005ddc6  /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/lib/x86_64/libtask_vision_jni.so
23:23:26.896 DEBUG              A        #10 pc 000000000005c51e  /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/lib/x86_64/libtask_vision_jni.so
23:23:26.896 DEBUG              A        #11 pc 0000000000042a6b  /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/lib/x86_64/libtask_vision_jni.so (Java_org_tensorflow_lite_task_vision_detector_ObjectDetector_detectNative+59)
23:23:26.896 DEBUG              A        #12 pc 000000000037d28b  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+219) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #13 pc 0000000000368fd9  /apex/com.android.art/lib64/libart.so (nterp_helper+2153) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #14 pc 000000000041d2ea  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (org.tensorflow.lite.task.vision.detector.ObjectDetector.detect+14)
23:23:26.896 DEBUG              A        #15 pc 0000000000369608  /apex/com.android.art/lib64/libart.so (nterp_helper+3736) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #16 pc 000000000041d25c  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (org.tensorflow.lite.task.vision.detector.ObjectDetector.access$1200+0)
23:23:26.896 DEBUG              A        #17 pc 00000000003687a8  /apex/com.android.art/lib64/libart.so (nterp_helper+56) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #18 pc 000000000041ce6c  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (org.tensorflow.lite.task.vision.detector.ObjectDetector$4.run+4)
23:23:26.896 DEBUG              A        #19 pc 0000000000369dbe  /apex/com.android.art/lib64/libart.so (nterp_helper+5710) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #20 pc 000000000041ce4c  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (org.tensorflow.lite.task.vision.detector.ObjectDetector$4.run+0)
23:23:26.896 DEBUG              A        #21 pc 000000000036ab40  /apex/com.android.art/lib64/libart.so (nterp_helper+9168) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #22 pc 000000000041c83e  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (org.tensorflow.lite.task.vision.core.BaseVisionTaskApi.run+54)
23:23:26.896 DEBUG              A        #23 pc 0000000000369608  /apex/com.android.art/lib64/libart.so (nterp_helper+3736) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #24 pc 000000000041d33a  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (org.tensorflow.lite.task.vision.detector.ObjectDetector.detect+10)
23:23:26.896 DEBUG              A        #25 pc 0000000000369608  /apex/com.android.art/lib64/libart.so (nterp_helper+3736) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #26 pc 000000000041d314  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (org.tensorflow.lite.task.vision.detector.ObjectDetector.detect+16)
23:23:26.896 DEBUG              A        #27 pc 0000000000369608  /apex/com.android.art/lib64/libart.so (nterp_helper+3736) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #28 pc 0000000000033c92  /data/data/com.ammar.havenwalls/code_cache/.overlay/base.apk/classes17.dex (com.ammar.havenwalls.ui.crop.CropViewModel$detectObjects$1$2.invokeSuspend+178)
23:23:26.896 DEBUG              A        #29 pc 000000000202ea05  /memfd:jit-cache (deleted) (kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith+309)
23:23:26.896 DEBUG              A        #30 pc 0000000002014a9c  /memfd:jit-cache (deleted) (kotlinx.coroutines.DispatchedTask.run+2012)
23:23:26.896 DEBUG              A        #31 pc 000000000036a3ca  /apex/com.android.art/lib64/libart.so (nterp_helper+7258) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #32 pc 000000000035644a  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (kotlinx.coroutines.internal.LimitedDispatcher.run+26)
23:23:26.896 DEBUG              A        #33 pc 000000000036a421  /apex/com.android.art/lib64/libart.so (nterp_helper+7345) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #34 pc 000000000035defe  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (kotlinx.coroutines.scheduling.TaskImpl.run+6)
23:23:26.896 DEBUG              A        #35 pc 0000000000369608  /apex/com.android.art/lib64/libart.so (nterp_helper+3736) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #36 pc 000000000035d002  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely+2)
23:23:26.896 DEBUG              A        #37 pc 0000000000369608  /apex/com.android.art/lib64/libart.so (nterp_helper+3736) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #38 pc 000000000035bd0e  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask+34)
23:23:26.896 DEBUG              A        #39 pc 0000000000369608  /apex/com.android.art/lib64/libart.so (nterp_helper+3736) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #40 pc 000000000035be3c  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker+56)
23:23:26.896 DEBUG              A        #41 pc 0000000000369608  /apex/com.android.art/lib64/libart.so (nterp_helper+3736) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #42 pc 000000000035bdec  [anon:dalvik-classes18.dex extracted in memory from /data/app/~~YZA5wZCbtPPgacPRPrHayg==/com.ammar.havenwalls-A6Pw6rODYvDy-YHQy_jHew==/base.apk!classes18.dex] (kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run+0)
23:23:26.896 DEBUG              A        #43 pc 0000000000372144  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+756) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #44 pc 00000000003f1b46  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+214) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #45 pc 00000000007e596e  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+478) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #46 pc 000000000083a0ac  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1404) (BuildId: a5a11e17ddeb3fe4395528da1842c05c)
23:23:26.896 DEBUG              A        #47 pc 00000000000cca4a  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+58) (BuildId: 76cb658c499bceaab85932d1254e26df)
23:23:26.896 DEBUG              A        #48 pc 00000000000609f7  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+55) (BuildId: 76cb658c499bceaab85932d1254e26df)
23:23:26.902 tombstoned         E  Tombstone written to: tombstone_03
```
</details>