Bugzilla – Bug 695488
Another UnsatisfiedLinkError with Android NDK Rev.10b
Last modified: 2014-10-09 03:22:01 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.reflect.Method.invokeNative(Native Method)
at dalvik.system.NativeStart.main(Native Method)
I have also tried NDK Rev.10 and Rev. 9d. Same exception appeared.
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.
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.
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
(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.
Yes, here it is.
A colleague gave me 9d for Mac. I didnt download it.
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.
*** Bug 695381 has been marked as a duplicate of this bug. ***
Ok, thank you. I'll take the 32-Bit version.