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

UnsatisfiedLinkError: couldn't find "libmxnet_predict.so" #1

Closed
ptrblck opened this issue May 31, 2017 · 3 comments
Closed

UnsatisfiedLinkError: couldn't find "libmxnet_predict.so" #1

ptrblck opened this issue May 31, 2017 · 3 comments

Comments

@ptrblck
Copy link

ptrblck commented May 31, 2017

Hi,

I cloned your repository and changed the SdkVersion to 23.
After building, the app crashes with the following error:

05-31 15:47:17.930 16412-16477/de.hpi.xnor_mxnet E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
                                                                   Process: de.hpi.xnor_mxnet, PID: 16412
                                                                   java.lang.RuntimeException: An error occurred while executing doInBackground()
                                                                       at android.os.AsyncTask$3.done(AsyncTask.java:309)
                                                                       at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
                                                                       at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
                                                                       at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                                                                       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
                                                                       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                                       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                       at java.lang.Thread.run(Thread.java:818)
                                                                    Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/de.hpi.xnor_mxnet-1/base.apk", zip file "/data/app/de.hpi.xnor_mxnet-1/split_lib_dependencies_apk.apk", zip file "/data/app/de.hpi.xnor_mxnet-1/split_lib_slice_0_apk.apk", zip file "/data/app/de.hpi.xnor_mxnet-1/split_lib_slice_1_apk.apk", zip file "/data/app/de.hpi.xnor_mxnet-1/split_lib_slice_2_apk.apk", zip file "/data/app/de.hpi.xnor_mxnet-1/split_lib_slice_3_apk.apk", zip file "/data/app/de.hpi.xnor_mxnet-1/split_lib_slice_4_apk.apk", zip file "/data/app/de.hpi.xnor_mxnet-1/split_lib_slice_5_apk.apk", zip file "/data/app/de.hpi.xnor_mxnet-1/split_lib_slice_6_apk.apk", zip file "/data/app/de.hpi.xnor_mxnet-1/split_lib_slice_7_apk.apk", zip file "/data/app/de.hpi.xnor_mxnet-1/split_lib_slice_8_apk.apk", zip file "/data/app/de.hpi.xnor_mxnet-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/de.hpi.xnor_mxnet-1/lib/arm64, /data/app/de.hpi.xnor_mxnet-1/base.apk!/lib/arm64-v8a, /data/app/de.hpi.xnor_mxnet-1/split_lib_dependencies_apk.apk!/lib/arm64-v8a, /data/app/de.hpi.xnor_mxnet-1/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /data/app/de.hpi.xnor_mxnet-1/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /data/app/de.hpi.xnor_mxnet-1/split_lib_slice_2_apk.apk!/lib/arm64-v8a, /data/app/de.hpi.xnor_mxnet-1/split_lib_slice_3_apk.apk!/lib/arm64-v8a, /data/app/de.hpi.xnor_mxnet-1/split_lib_slice_4_apk.apk!/lib/arm64-v8a, /data/app/de.hpi.xnor_mxnet-1/split_lib_slice_5_apk.apk!/lib/arm64-v8a, /data/app/de.hpi.xnor_mxnet-1/split_lib_slice_6_apk.apk!/lib/arm64-v8a, /data/app/de.hpi.xnor_mxnet-1/split_lib_slice_7_apk.apk!/lib/arm64-v8a, /data/app/de.hpi.xnor_mxnet-1/split_lib_slice_8_apk.apk!/lib/arm64-v8a, /data/app/de.hpi.xnor_mxnet-1/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libmxnet_predict.so"
                                                                       at java.lang.Runtime.loadLibrary(Runtime.java:367)
                                                                       at java.lang.System.loadLibrary(System.java:1076)
                                                                       at org.dmlc.mxnet.Predictor.<clinit>(Predictor.java:8)
                                                                       at de.hpi.xnor_mxnet.imageclassification.ImageNetClassifier.loadModel(ImageNetClassifier.java:65)
                                                                       at de.hpi.xnor_mxnet.imageclassification.ModelPreparationTask.doInBackground(ModelPreparationTask.java:31)
                                                                       at de.hpi.xnor_mxnet.imageclassification.ModelPreparationTask.doInBackground(ModelPreparationTask.java:11)
                                                                       at android.os.AsyncTask$2.call(AsyncTask.java:295)
                                                                       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
                                                                       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                                                                       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                                                                       at java.lang.Thread.run(Thread.java:818) 
05-31 15:47:18.968 16412-16477/de.hpi.xnor_mxnet I/Process: Sending signal. PID: 16412 SIG: 9

The project tree however shows the libmxnet_predict.so in app/jniLibs/armeabi-v7a/.
The lib itself is located in app/src/main/jniLibs/armeabi-v7a/.

Do you have any idea, why the libmxnet_predict.so cannot be found on my phone?

Greets!
Piotr

@Bartzi
Copy link
Contributor

Bartzi commented May 31, 2017

Hi Piotr,

the problem is that your phone seems to have a 64 bit processor. The library we added to the repository is compiled for 32 bit arm processors.

You can clone the BMXNet repository and amalgate the library using the 64 bit, clang toolchain. After you've done this, you can copy the resulting libmxnet_predict.so into the folder jniLibs/arm64-v8a (this should be the right name) and then it should also work on your phone.

I think we still have a compiled version of BMXNet for 64 bit arm-processors somewhere here. Once we find it, we will add it to the repository!

Hope that helps!

@Bartzi
Copy link
Contributor

Bartzi commented Jun 2, 2017

I've added a 64 Bit version of the library to the repository. It should work now for you!
I'm closing this issue, if it does not work because of the same reason, please open it again!

@Bartzi Bartzi closed this as completed Jun 2, 2017
@ptrblck
Copy link
Author

ptrblck commented Jun 2, 2017

Thanks! It works now :)

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

2 participants