Bug 695488 - Another UnsatisfiedLinkError with Android NDK Rev.10b
Another UnsatisfiedLinkError with Android NDK Rev.10b
Status: RESOLVED FIXED
Product: MuPDF
Classification: Unclassified
Component: mupdf
unspecified
Android Phone Android
: P4 critical
Assigned To: muPDF bugs
Bug traffic
:
: 695381 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-15 07:23 PDT by Paul
Modified: 2014-10-09 03:22 PDT (History)
3 users (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul 2014-09-15 07:23:37 PDT
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 PDT
I have also tried NDK Rev.10 and Rev. 9d. Same exception appeared.
Comment 2 Tor Andersson 2014-09-17 06:25:53 PDT
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 PDT
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 PDT
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 PDT
(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 PDT
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 PDT
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 PDT
*** Bug 695381 has been marked as a duplicate of this bug. ***
Comment 9 Paul 2014-10-09 03:22:01 PDT
Ok, thank you. I'll take the 32-Bit version.