xroche/coffeecatch

can't compile on mips

Closed this issue · 5 comments

[mips] Compile        : NativeSampler <= coffeecatch.c
jni/coffeecatch/coffeecatch.c:79:58: error: 'SIGSTKFLT' undeclared here (not in a function)
jni/coffeecatch/coffeecatch.c: In function 'coffeecatch_get_pc_from_ucontext':
jni/coffeecatch/coffeecatch.c:1011:2: error: #error "Architecture is unknown, please report me!"
make.exe: *** [obj/local/mips/objs/NativeSampler/coffeecatch/coffeecatch.o] Error 1

armeabi works perfectly, but when it comes to the mips part, it won't compile.
Using android-ndk-r9d-windows-x86_64

Also, below android 2.2 (or possibly 2.3) sigaltstack is not available and causes loadLibrary to fail. I tested this on emulator and device. Is there a minimum Android version that is supported?

Normally 2.2 should be fine!

Can you test MIPS now ? Issue with "Architecture is unknown" should be fixed by ae35ddb

It compiles perfectly now on MIPS and catches the error and provides a somewhat proper stacktrace.

I don't know if it is just the emulator, the native stacktrace is not very detailed here, it doesn't show the native method names. Is this is a limitation of MIPS or just the emulator?

Anyway thanks for the fix!

`07-29 17:33:18.333: A/libc(1539): Fatal signal 11 (SIGSEGV) at 0x00000018 (code=1), thread 1558 (Thread-72)
07-29 17:33:18.333: W/dalvikvm(1539): threadid=10: thread exiting with uncaught exception (group=0xb4eea288)
07-29 17:33:18.333: E/AndroidRuntime(1539): FATAL EXCEPTION: Thread-72
07-29 17:33:18.333: E/AndroidRuntime(1539): java.lang.Error: signal 11 (Address not mapped to object) at address 0x18 [at libcoffeedJNI.so:0x2deb (_Z4playP7_JNIEnvP7_jclassxixx+0x8b)]
07-29 17:33:18.333: E/AndroidRuntime(1539):     at nativesampler.NativeSampler.play(Native Method)
07-29 17:33:18.333: E/AndroidRuntime(1539):     at nativesampler.NativeSampler.play(NativeSampler.java:213)
[..]
07-29 17:33:18.333: E/AndroidRuntime(1539): Caused by: java.lang.Error: signal 11 (Address not mapped to object) at address 0x18 [at libcoffeedJNI.so:0x2deb (_Z4playP7_JNIEnvP7_jclassxixx+0x8b)]
07-29 17:33:18.333: E/AndroidRuntime(1539):     at data.data.umito_android_minipiano_pro.lib.libcoffeedJNI_so.0x2deb(Native Method)
07-29 17:33:18.333: E/AndroidRuntime(1539):     at system.lib.libc_so.0x1400(Native Method)
07-29 17:33:18.333: E/AndroidRuntime(1539):     at data.data.umito_android_minipiano_pro.lib.libNativeSampler_so.0x35d0(Native Method)
07-29 17:33:18.333: E/AndroidRuntime(1539):     at <unknown>.0x20247489(Native Method)

Unfortunately there is no simple way to get the function name directly.

However, you can easily get it using addr2line:

PATH_TO_ANDROID_SDK/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-addr2line -C -f -e libNativeSampler.so 0x35d0

(replace PATH_TO_ANDROID_SDK by correct path and use proper architecture, of course)

EDIT: with Android >= 4.1.1, you should get the function names (libcorkscrew is used by coffeecatch, if available)