|Summary:||Another UnsatisfiedLinkError with Android NDK Rev.10b|
|Component:||mupdf||Assignee:||muPDF bugs <mupdf-bugs>|
|Status:||RESOLVED FIXED||QA Contact:||Bug traffic <tech>|
|Priority:||P4||CC:||robin.watts, sambrook2000, tor.andersson|
Description Paul 2014-09-15 07:23:37 UTC
Hello, i got a fatal exception, when i tried to open a pdf file. I'm using the latest NDK Rev. 10b. Can you help me? What NDK Revision should i use? java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "rand" referenced by "libmupdf.so"... at java.lang.Runtime.loadLibrary(Runtime.java:364) at java.lang.System.loadLibrary(System.java:526) at com.artifex.mupdfdemo.MuPDFCore.<clinit>(MuPDFCore.java:14) at com.artifex.mupdfdemo.MuPDFActivity.openFile(MuPDFActivity.java:214) at com.artifex.mupdfdemo.MuPDFActivity.onCreate(MuPDFActivity.java:320) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method)
Comment 1 Paul 2014-09-15 08:49:42 UTC
I have also tried NDK Rev.10 and Rev. 9d. Same exception appeared.
Comment 2 Tor Andersson 2014-09-17 06:25:53 UTC
I have just built MuPDF on a clean install with SDK 23.0.2 and NDK 10b on Linux. I installed Android SDK Platform-tools 20 and Android SDK Build-tools 20. I installed SDK Platform 18 (4.3, API 18) and the ARM EABI v7a System Image 18. I set up an emulator image for Android 4.3. "ndk-build" finished as expected. "ant debug" finished as expected. "ant debug install" on the emulator, works as expected. "ant debug install" on my nexus 10 hardware, works as expected. No errors anywhere. Are you building on Linux or Windows? Are you using Eclipse or any other unsupported build system? We only support using the plain SDK and NDK command line tools.
Comment 3 Paul 2014-09-17 07:29:15 UTC
Hi, I'm using Mac OS Mavericks. I followed the steps here http://www.mupdf.com/docs/how-to-build-mupdf-for-android. I used ndk and ant in terminal only (no ide for build). I was also in the irc support chat yesterday and one developer told me to try NDK Rev. 8c. NDK Rev. 8c works now. I also tried 10b, 10, and 9d without success. 8c is running.
Comment 4 Paul 2014-09-17 07:35:36 UTC
The app started on my device. When i opened a pdf file, then the crash happened. But with NDK 8c its running wihtout problems.. I dont know why its running on Linux but not on Mac
Comment 5 Robin Watts 2014-09-17 07:43:53 UTC
(In reply to Paul from comment #3) > I'm using Mac OS Mavericks. I followed the steps here > http://www.mupdf.com/docs/how-to-build-mupdf-for-android. I used ndk and ant > in terminal only (no ide for build). I was also in the irc support chat > yesterday and one developer told me to try NDK Rev. 8c. NDK Rev. 8c works > now. I also tried 10b, 10, and 9d without success. 8c is running. Paul, can you give us the exact download link you used for your version of the ndk please? (for versions 10b, 10 and 9d). Thanks.
Comment 6 Paul 2014-09-17 08:04:23 UTC
Yes, here it is. http://dl.google.com/android/ndk/android-ndk64-r10b-darwin-x86_64.tar.bz2 (10b) http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86_64.tar.bz2 (10) A colleague gave me 9d for Mac. I didnt download it.
Comment 7 Tor Andersson 2014-09-25 05:31:24 UTC
You need to use the 32-bit NDK (android-ndk32-r10b-darwin-x86_64) if building for 32-bit targets. In the ARM headers in the 32-bit target NDK, rand() is declared as a static inline function (and as such does not need to exist as a symbol in libc.so on ARM devices). In the ARM headers in the 64-bit target NDK, rand() is declared as a regular function, but since it does not exist in the libc.so on ARM devices, there is a runtime error. Ergo, use the 32-bit target NDK when targeting 32-bit platforms. Or tell Google that their shit is broken.
Comment 8 Tor Andersson 2014-10-02 10:44:39 UTC
*** Bug 695381 has been marked as a duplicate of this bug. ***
Comment 9 Paul 2014-10-09 03:22:01 UTC
Ok, thank you. I'll take the 32-Bit version.