Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

UnsatisfiedLinkError with Amalgamation for Android #8666

Closed
dmazzoni opened this issue Nov 15, 2017 · 2 comments
Closed

UnsatisfiedLinkError with Amalgamation for Android #8666

dmazzoni opened this issue Nov 15, 2017 · 2 comments

Comments

@dmazzoni
Copy link

dmazzoni commented Nov 15, 2017

Description

I have compiled libmxpredict.so for Android following the guide found at #7146, but loading it inside an app causes a java.lang.UnsatisfiedLinkError at runtime.

Environment info

Operating System: macOS 10.13.1
NDK version: android-ndk-r14b
Compiler: arm-linux-androideabi-clang++
MXNet version: v0.12.0
MXNet commit hash : * 0.12.0 4f2af2d

Error message

Process: com.happen.it.make.whatsthis, PID: 29304
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN4dmlc2io10FileSystem22ListDirectoryRecursiveERKNS0_3URIEPNSt6__ndk16vectorINS0_8FileInfoENS5_9allocatorIS7_EEEE" referenced by "/data/app/com.happen.it.make.whatsthis-2/lib/arm/libmxnet_predict.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
at org.dmlc.mxnet.Predictor.<clinit>(Predictor.java:5)
at com.happen.it.make.whatisit.WhatsApplication.onCreate(WhatsApplication.java:48)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Minimum reproducible example

I am compiling the WhatsThis sample app from my repo (https://github.com/dmazzoni/WhatsThis.git) with Android Studio 3.0, and running it on a Nexus 5 with Android 6.0.1. The repository includes the libmx_predict.so I recompiled, together with libopenblas.so and libc++_shared.so, whose absence caused linker errors, now solved.

Steps to reproduce

  1. Compile and run the Android application.
@dmazzoni dmazzoni changed the title UnsatisfiedLinkError with Amalgamation for Android: UnsatisfiedLinkError with Amalgamation for Android Nov 15, 2017
@dmazzoni
Copy link
Author

Solved by adding the line #include "../dmlc-core/src/io/filesys.cc" to dmlc-minimum0.cc

@bryanlinnan
Copy link

hi,i followed your method, add the line to dmlc-minimum0.cc and recompile another libmxnet_predict.so, still got the error: "can not locate symbol _ZN4dmlc2io10FileSystem22ListDirectoryRecursiveERKNS0_3URIEPNSt6__ndk16vectorINS0_8FileInfoENS5_9allocatorIS7_EEEE" referenced by "/data/app/com.happen.it.make.whatsthis-2/lib/arm/libmxnet_predict.so"." is there any other step you did?

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

No branches or pull requests

2 participants