Page 1 of 1

Crash on Android with OGRE_THREAD_SUPPORT=2 on Galaxy Nexus

Posted: Sat Jun 15, 2013 9:29 pm
by robert82h
Hi, has anyone successfully used Ogre compiled with thread support (OGRE_THREAD_SUPPORT = 2) on a Galaxy Nexus device?

I'm debugging a really weird crash on this device (running Android 4.2.2). On a Nexus 10 tablet, also running 4.2.2, the very same APK runs just fine. When I disable thread support and rebuild Ogre, the app doesn't crash.

Here are the details of the crash, it happens when my JNI library is loaded but before JNI_OnLoad() is run. I suspect that there's a problem caused during construction of a static object instance (probably in a native thread created by Ogre):

Code: Select all

I/ActivityManager(  389): Start proc com.example.ogreTest for activity com.example.ogreTest/.MainActivity: pid=26637 uid=10154 gids={50154, 3003, 1028}
D/dalvikvm(26637): Trying to load lib /data/app-lib/com.example.ogreTest-1/libOgreTestJNI.so 0x41e30068
F/libc    (26637): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 26637 (com.example.ogreTest)
I/DEBUG   (  127): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  127): Build fingerprint: 'google/yakju/maguro:4.2.2/JDQ39/573038:user/release-keys'
I/DEBUG   (  127): Revision: '9'
I/DEBUG   (  127): pid: 26637, tid: 26637, name: com.example.ogreTest  >>> com.example.ogreTest <<<
I/DEBUG   (  127): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
I/DEBUG   (  127):     r0 00000027  r1 deadbaad  r2 40184258  r3 00000000
I/DEBUG   (  127):     r4 00000000  r5 beeaf4ec  r6 00000004  r7 400d3010
I/DEBUG   (  127):     r8 00000000  r9 4089a1b0  sl 40f09c20  fp 00000001
I/DEBUG   (  127):     ip 5f9d5bc4  sp beeaf4e8  lr 401570d9  pc 40153772  cpsr 60000030
I/DEBUG   (  127):     d0  000a297265706c65  d1  6572207369206c65
I/DEBUG   (  127):     d2  7420646572697571  d3  6874206e7572206f
I/DEBUG   (  127):     d4  72616e6962207369  d5  656b5f5f28202e79
I/DEBUG   (  127):     d6  706d635f6c656e72  d7  6820343667686378
I/DEBUG   (  127):     d8  0000000000000000  d9  0000000000000000
I/DEBUG   (  127):     d10 0000000000000000  d11 0000000000000000
I/DEBUG   (  127):     d12 0000000000000000  d13 0000000000000000
I/DEBUG   (  127):     d14 0000000000000000  d15 0000000000000000
I/DEBUG   (  127):     d16 0000000000000017  d17 0000000000000000
I/DEBUG   (  127):     d18 0000000000000000  d19 00bc800000b98000
I/DEBUG   (  127):     d20 00b6802e00b3802d  d21 00bc802f00b9802f
I/DEBUG   (  127):     d22 0707070703030303  d23 0000002f0000002e
I/DEBUG   (  127):     d24 0000000000000000  d25 0000000000000000
I/DEBUG   (  127):     d26 0000002f0000002f  d27 0000002f0000002f
I/DEBUG   (  127):     d28 0001000000010000  d29 0001000000010000
I/DEBUG   (  127):     d30 0003000000030000  d31 0003000000030000
I/DEBUG   (  127):     scr 60000090
I/DEBUG   (  127): 
I/DEBUG   (  127): backtrace:
I/DEBUG   (  127):     #00  pc 0001a772  /system/lib/libc.so
I/DEBUG   (  127):     #01  pc 00018070  /system/lib/libc.so (abort+4)
I/DEBUG   (  127):     #02  pc 00723b4c  /data/app-lib/com.example.ogreTest-1/libOgreTestJNI.so
I/DEBUG   (  127):     #03  pc 00003273  /system/bin/linker
I/DEBUG   (  127):     #04  pc 000050cb  /system/bin/linker
I/DEBUG   (  127):     #05  pc 0004f92b  /system/lib/libdvm.so (dvmLoadNativeCode(char const*, Object*, char**)+186)
I/DEBUG   (  127):     #06  pc 00066785  /system/lib/libdvm.so
I/DEBUG   (  127):     #07  pc 000276a0  /system/lib/libdvm.so
I/DEBUG   (  127):     #08  pc 0002b57c  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
I/DEBUG   (  127):     #09  pc 0005fc31  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
I/DEBUG   (  127):     #10  pc 0005fc5b  /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
I/DEBUG   (  127):     #11  pc 0006acb1  /system/lib/libdvm.so (dvmInitClass+1036)
I/DEBUG   (  127):     #12  pc 000661a3  /system/lib/libdvm.so
I/DEBUG   (  127):     #13  pc 000276a0  /system/lib/libdvm.so
I/DEBUG   (  127):     #14  pc 0002b57c  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
I/DEBUG   (  127):     #15  pc 0005ff07  /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374)
I/DEBUG   (  127):     #16  pc 000677e1  /system/lib/libdvm.so
I/DEBUG   (  127):     #17  pc 000276a0  /system/lib/libdvm.so
I/DEBUG   (  127):     #18  pc 0002b57c  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
I/DEBUG   (  127):     #19  pc 0005fc31  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
I/DEBUG   (  127):     #20  pc 000499fb  /system/lib/libdvm.so
I/DEBUG   (  127):     #21  pc 00046871  /system/lib/libandroid_runtime.so
I/DEBUG   (  127):     #22  pc 00047533  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+390)
I/DEBUG   (  127):     #23  pc 00000db7  /system/bin/app_process
I/DEBUG   (  127):     #24  pc 0001271f  /system/lib/libc.so (__libc_init+38)
I/DEBUG   (  127):     #25  pc 00000ae8  /system/bin/app_process
I/DEBUG   (  127): 
I/DEBUG   (  127): stack:
I/DEBUG   (  127):          beeaf4a8  c0000000  
I/DEBUG   (  127):          beeaf4ac  00000019  
I/DEBUG   (  127):          beeaf4b0  c0000000  
I/DEBUG   (  127):          beeaf4b4  0000001c  
I/DEBUG   (  127):          beeaf4b8  5fa30760  
I/DEBUG   (  127):          beeaf4bc  00000010  
I/DEBUG   (  127):          beeaf4c0  40181254  /system/lib/libc.so
I/DEBUG   (  127):          beeaf4c4  401811b4  /system/lib/libc.so
I/DEBUG   (  127):          beeaf4c8  00000000  
I/DEBUG   (  127):          beeaf4cc  401570d9  /system/lib/libc.so (_fwalk+32)
I/DEBUG   (  127):          beeaf4d0  00000001  
I/DEBUG   (  127):          beeaf4d4  beeaf4ec  [stack]
I/DEBUG   (  127):          beeaf4d8  00000004  
I/DEBUG   (  127):          beeaf4dc  400d3010  
I/DEBUG   (  127):          beeaf4e0  df0027ad  
I/DEBUG   (  127):          beeaf4e4  00000000  
I/DEBUG   (  127):     #00  beeaf4e8  5f7e6d85  /data/app-lib/com.example.ogreTest-1/libOgreTestJNI.so
I/DEBUG   (  127):          beeaf4ec  fffffbdf  
I/DEBUG   (  127):          beeaf4f0  5f9d6000  /data/app-lib/com.example.ogreTest-1/libOgreTestJNI.so
I/DEBUG   (  127):          beeaf4f4  5dda2680  
I/DEBUG   (  127):          beeaf4f8  5fa30760  
I/DEBUG   (  127):          beeaf4fc  5fa29ba4  
I/DEBUG   (  127):          beeaf500  5fa29b54  
I/DEBUG   (  127):          beeaf504  5f9b835c  /data/app-lib/com.example.ogreTest-1/libOgreTestJNI.so
I/DEBUG   (  127):          beeaf508  00000002  
I/DEBUG   (  127):          beeaf50c  40151074  /system/lib/libc.so (__pthread_clone)
I/DEBUG   (  127):     #01  beeaf510  00000004  
I/DEBUG   (  127):          beeaf514  5f7ebb50  /data/app-lib/com.example.ogreTest-1/libOgreTestJNI.so
I/DEBUG   (  127):     #02  beeaf518  5fa27a10  
I/DEBUG   (  127):          beeaf51c  656e2041  
I/DEBUG   (  127):          beeaf520  20726577  
I/DEBUG   (  127):          beeaf524  6e72656b  
I/DEBUG   (  127):          beeaf528  69206c65  
I/DEBUG   (  127):          beeaf52c  65722073  
I/DEBUG   (  127):          beeaf530  72697571  
I/DEBUG   (  127):          beeaf534  74206465  
I/DEBUG   (  127):          beeaf538  7572206f  
I/DEBUG   (  127):          beeaf53c  6874206e  
I/DEBUG   (  127):          beeaf540  62207369  
I/DEBUG   (  127):          beeaf544  72616e69  
I/DEBUG   (  127):          beeaf548  28202e79  
I/DEBUG   (  127):          beeaf54c  656b5f5f  
I/DEBUG   (  127):          beeaf550  6c656e72  
I/DEBUG   (  127):          beeaf554  706d635f  
I/DEBUG   (  127):          ........  ........
I/DEBUG   (  127): 
I/DEBUG   (  127): memory near r2:
I/DEBUG   (  127):     40184238 00000007 00000002 00000000 00000000  
I/DEBUG   (  127):     40184248 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     40184258 00000001 00000000 00000000 00000000  
I/DEBUG   (  127):     40184268 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     40184278 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     40184288 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     40184298 00000000 00000000 005e9273 00000000  
I/DEBUG   (  127):     401842a8 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     401842b8 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     401842c8 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     401842d8 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     401842e8 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     401842f8 00000000 00000000 00000000 00004000  
I/DEBUG   (  127):     40184308 00000000 00000000 00000000 00004000  
I/DEBUG   (  127):     40184318 00000000 00000000 00000000 00004000  
I/DEBUG   (  127):     40184328 00000000 00000000 00000000 00004000  
I/DEBUG   (  127): 
I/DEBUG   (  127): memory near r5:
I/DEBUG   (  127):     beeaf4cc 401570d9 00000001 beeaf4ec 00000004  
I/DEBUG   (  127):     beeaf4dc 400d3010 df0027ad 00000000 5f7e6d85  
I/DEBUG   (  127):     beeaf4ec fffffbdf 5f9d6000 5dda2680 5fa30760  
I/DEBUG   (  127):     beeaf4fc 5fa29ba4 5fa29b54 5f9b835c 00000002  
I/DEBUG   (  127):     beeaf50c 40151074 00000004 5f7ebb50 5fa27a10  
I/DEBUG   (  127):     beeaf51c 656e2041 20726577 6e72656b 69206c65  
I/DEBUG   (  127):     beeaf52c 65722073 72697571 74206465 7572206f  
I/DEBUG   (  127):     beeaf53c 6874206e 62207369 72616e69 28202e79  
I/DEBUG   (  127):     beeaf54c 656b5f5f 6c656e72 706d635f 67686378  
I/DEBUG   (  127):     beeaf55c 68203436 65706c65 000a2972 5f9b8358  
I/DEBUG   (  127):     beeaf56c 40114275 40126840 00000001 41e30068  
I/DEBUG   (  127):     beeaf57c 401160cf 5cea3fc8 4083b92f 00000000  
I/DEBUG   (  127):     beeaf58c 41e317d8 0000006e beeaf5cc 00000006  
I/DEBUG   (  127):     beeaf59c 4089a1b0 5cea3fc8 5cea3fc8 00000000  
I/DEBUG   (  127):     beeaf5ac 400d3020 beeaf5cc 41e30068 00000006  
I/DEBUG   (  127):     beeaf5bc 40f09c20 00000000 40852789 40f09c34  
I/DEBUG   (  127): 
I/DEBUG   (  127): memory near r7:
I/DEBUG   (  127):     400d2ff0 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     400d3000 00000000 00000000 00000000 00000453  
I/DEBUG   (  127):     400d3010 59fc71f8 40f09c34 56dcb7d0 40f0f000  
I/DEBUG   (  127):     400d3020 41e31858 b936db2c beeaf5e8 00000000  
I/DEBUG   (  127):     400d3030 beeaf61c 00000001 00000000 4080a400  
I/DEBUG   (  127):     400d3040 00000000 00000000 562e2c70 40f04300  
I/DEBUG   (  127):     400d3050 00000000 00000000 00000001 00006000  
I/DEBUG   (  127):     400d3060 00000000 4012b3dc 4080a400 4080f2c0  
I/DEBUG   (  127):     400d3070 00000000 408133bc 40813430 408132e0  
I/DEBUG   (  127):     400d3080 40813300 4081335c 00000000 00000000  
I/DEBUG   (  127):     400d3090 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     400d30a0 00000000 00000000 00002000 4089a8d4  
I/DEBUG   (  127):     400d30b0 00000000 00000000 00000006 40f4f130  
I/DEBUG   (  127):     400d30c0 00000001 00000080 00000200 00000000  
I/DEBUG   (  127):     400d30d0 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     400d30e0 00000000 00000000 00000000 00000000  
I/DEBUG   (  127): 
I/DEBUG   (  127): memory near r9:
I/DEBUG   (  127):     4089a190 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     4089a1a0 00000000 00000000 00000000 00000000  
I/DEBUG   (  127):     4089a1b0 4159d858 4159d848 00800000 10000000  
I/DEBUG   (  127):     4089a1c0 06000000 00000000 00000000 3fe80000  
I/DEBUG   (  127):     4089a1d0 00080000 00800000 00004000 00006000  
I/DEBUG   (  127):     4089a1e0 00000001 00000101 00000002 00000001  
I/DEBUG   (  127):     4089a1f0 00000000 00000000 00000000 00000002  
I/DEBUG   (  127):     4089a200 00000000 4022a7f5 4022b221 00000000  
I/DEBUG   (  127):     4089a210 4022a7e1 00000000 00000000 00000000  
I/DEBUG   (  127):     4089a220 4159da80 00000000 00000002 00000003  
I/DEBUG   (  127):     4089a230 00000001 00000001 00010100 00000100  
I/DEBUG   (  127):     4089a240 00000000 4159d9b8 00000003 00000000  
I/DEBUG   (  127):     4089a250 4159d9a8 400d3db8 00000000 00000000  
I/DEBUG   (  127):     4089a260 4159df20 50000aae 40f0a008 00000000  
I/DEBUG   (  127):     4089a270 4009cbd8 4009cbf8 4159e1e8 4159e2a8  
I/DEBUG   (  127):     4089a280 4159e350 4159e3f8 4159e4a0 4159e548  
I/DEBUG   (  127): 
I/DEBUG   (  127): memory near sl:
I/DEBUG   (  127):     40f09c00 41e31708 41e316b0 00000000 00000003  
I/DEBUG   (  127):     40f09c10 41e31858 41e300c0 41e31610 40f09c50  
I/DEBUG   (  127):     40f09c20 40f09c50 57db506a 56dcb3a0 00000006  
I/DEBUG   (  127):     40f09c30 00000000 41e31858 41e30068 40f09ca0  
I/DEBUG   (  127):     40f09c40 57dbac68 56dcb7d0 57db506a 00000000  
I/DEBUG   (  127):     40f09c50 57d8c6d2 56d124b8 57d8c6fe 00000000  
I/DEBUG   (  127):     40f09c60 415a6d80 41e31858 00000000 41e30068  
I/DEBUG   (  127):     40f09c70 41e31658 40f09ca0 40f09ca0 57dbac60  
I/DEBUG   (  127):     40f09c80 416100b0 41e31610 41e30068 40f09cc0  
I/DEBUG   (  127):     40f09c90 59fc71fc 56d31958 57dbac68 00000000  
I/DEBUG   (  127):     40f09ca0 416100b0 41e30068 41e31610 40f09cd8  
I/DEBUG   (  127):     40f09cb0 00000000 56fdd408 59fc71fc 41e30068  
I/DEBUG   (  127):     40f09cc0 41e31610 40f09cec 00000000 00000000  
I/DEBUG   (  127):     40f09cd0 00000000 41e31360 40f09d04 57dacf08  
I/DEBUG   (  127):     40f09ce0 56d10f38 00000006 00000000 41e31360  
I/DEBUG   (  127):     40f09cf0 40f09d20 583bb8d0 56d11b48 57dacf08  
I/DEBUG   (  127): 
I/DEBUG   (  127): memory near ip:
I/DEBUG   (  127):     5f9d5ba4 4015e9b1 4015e97f 40145f09 40145ef5  
I/DEBUG   (  127):     5f9d5bb4 401476cc 401478a8 401477fc 401475fc  
I/DEBUG   (  127):     5f9d5bc4 4015106c 40151bf0 4014fd88 40151ca9  
I/DEBUG   (  127):     5f9d5bd4 4015dd8b 4015dca9 4015e03d 4014f865  
I/DEBUG   (  127):     5f9d5be4 4015e645 4015e91f 4015dda9 4015dd6d  
I/DEBUG   (  127):     5f9d5bf4 4015dd55 4015db45 4015d979 4015d979  
I/DEBUG   (  127):     5f9d5c04 40161bc1 4015dd95 40147ee9 40155fc9  
I/DEBUG   (  127):     5f9d5c14 40157929 401565b5 40155f35 4014fd6c  
I/DEBUG   (  127):     5f9d5c24 40150014 4014fe44 4016374d 40150f50  
I/DEBUG   (  127):     5f9d5c34 40150478 401566f5 401566b9 40145f31  
I/DEBUG   (  127):     5f9d5c44 40157ad9 40171bb3 401518ac 4015557d  
I/DEBUG   (  127):     5f9d5c54 40147c05 4015a605 401b760c 401b7948  
I/DEBUG   (  127):     5f9d5c64 401b717c 401b71c4 401b78d0 401b7d80  
I/DEBUG   (  127):     5f9d5c74 401b7118 401b70e8 401b76e8 401b7a38  
I/DEBUG   (  127):     5f9d5c84 401b79d8 401b79a8 401b7a08 401b7990  
I/DEBUG   (  127):     5f9d5c94 401b79f0 401b7d68 401b7424 401b73dc  
I/DEBUG   (  127): 
I/DEBUG   (  127): memory near sp:
I/DEBUG   (  127):     beeaf4c8 00000000 401570d9 00000001 beeaf4ec  
I/DEBUG   (  127):     beeaf4d8 00000004 400d3010 df0027ad 00000000  
I/DEBUG   (  127):     beeaf4e8 5f7e6d85 fffffbdf 5f9d6000 5dda2680  
I/DEBUG   (  127):     beeaf4f8 5fa30760 5fa29ba4 5fa29b54 5f9b835c  
I/DEBUG   (  127):     beeaf508 00000002 40151074 00000004 5f7ebb50  
I/DEBUG   (  127):     beeaf518 5fa27a10 656e2041 20726577 6e72656b  
I/DEBUG   (  127):     beeaf528 69206c65 65722073 72697571 74206465  
I/DEBUG   (  127):     beeaf538 7572206f 6874206e 62207369 72616e69  
I/DEBUG   (  127):     beeaf548 28202e79 656b5f5f 6c656e72 706d635f  
I/DEBUG   (  127):     beeaf558 67686378 68203436 65706c65 000a2972  
I/DEBUG   (  127):     beeaf568 5f9b8358 40114275 40126840 00000001  
I/DEBUG   (  127):     beeaf578 41e30068 401160cf 5cea3fc8 4083b92f  
I/DEBUG   (  127):     beeaf588 00000000 41e317d8 0000006e beeaf5cc  
I/DEBUG   (  127):     beeaf598 00000006 4089a1b0 5cea3fc8 5cea3fc8  
I/DEBUG   (  127):     beeaf5a8 00000000 400d3020 beeaf5cc 41e30068  
I/DEBUG   (  127):     beeaf5b8 00000006 40f09c20 00000000 40852789  
I/DEBUG   (  127): 
I/DEBUG   (  127): code around pc:
I/DEBUG   (  127):     40153750 e000b164 6823461c d1fb2b00 68e3e026  
I/DEBUG   (  127):     40153760 4a17b123 447a2401 47986014 20274911  
I/DEBUG   (  127):     40153770 70082400 eb86f7fc f7fd2106 a902ecea  
I/DEBUG   (  127):     40153780 f04f2006 460a5380 94029304 f7fd9403  
I/DEBUG   (  127):     40153790 4629e8d0 20024622 e8d8f7fd eb72f7fc  
I/DEBUG   (  127):     401537a0 f7fd2106 2001ecd6 e892f7fc 2a006962  
I/DEBUG   (  127):     401537b0 e7d4d1dc deadbaad 0002d826 00030b0a  
I/DEBUG   (  127):     401537c0 00030aee 2400b510 aa04b088 46699002  
I/DEBUG   (  127):     401537d0 94014620 94039400 e830f7fd bfb842a0  
I/DEBUG   (  127):     401537e0 db054620 b1139b07 1c489906 98069006  
I/DEBUG   (  127):     401537f0 bd10b008 4604b510 e9c6f7fc d10542a0  
I/DEBUG   (  127):     40153800 447b4b04 6018681b bd102000 30fff04f  
I/DEBUG   (  127):     40153810 bf00bd10 0002d75a 460db538 481eb928  
I/DEBUG   (  127):     40153820 f7fc4478 2800edc4 b9fdd130 2102481b  
I/DEBUG   (  127):     40153830 f0014478 2800faae db274604 f7fc4629  
I/DEBUG   (  127):     40153840 2800ec4e 2101db0b f7fc4620 2800ec48  
I/DEBUG   (  127): 
I/DEBUG   (  127): code around lr:
I/DEBUG   (  127):     401570b8 41f0e92d 4c0b2600 447c4680 68a56824  
I/DEBUG   (  127):     401570c8 e0076867 300cf9b5 dd022b00 47c04628  
I/DEBUG   (  127):     401570d8 35544306 d5f53f01 2c006824 4630d1ef  
I/DEBUG   (  127):     401570e8 81f0e8bd 00029ec2 43f0e92d fb01461f  
I/DEBUG   (  127):     401570f8 f8dff602 b0878058 44f8460c 8000f8d8  
I/DEBUG   (  127):     40157108 9001a901 f8d84615 20013000 96059602  
I/DEBUG   (  127):     40157118 90049103 4638b113 fa35f7ff a9034638  
I/DEBUG   (  127):     40157128 fe9bf7ff 2000f8d8 b1124681 f7ff4638  
I/DEBUG   (  127):     40157138 f1b9fa37 d0050f00 46219d05 f01a1b70  
I/DEBUG   (  127):     40157148 4605ed46 b0074628 83f0e8bd 00029e3a  
I/DEBUG   (  127):     40157158 1e4b6841 2b006043 f000da01 6803bbab  
I/DEBUG   (  127):     40157168 2b01f813 46106003 00004770 4604b570  
I/DEBUG   (  127):     40157178 447e4e0d 68336836 f7ffb10b 6861fa04  
I/DEBUG   (  127):     40157188 60601e48 bfa22800 f8106820 60205b01  
I/DEBUG   (  127):     40157198 4620da03 fb8ef000 68324605 4620b112  
I/DEBUG   (  127):     401571a8 f9fef7ff bd704628 00029dc2 447b4b07  
I/DEBUG   (  127): 
I/DEBUG   (  127): memory map around fault addr deadbaad:
I/DEBUG   (  127):     bee8f000-beeb0000 [stack]
I/DEBUG   (  127):     (no map for address)
I/DEBUG   (  127):     ffff0000-ffff1000 [vectors]
Note that there's a line "Trying to load lib" but no corresponding "Added shared lib", i.e., the crash happens while global data is initialized.

I'm using NDK r8e. I tried Boost version 1.47 and 1.53 and made sure the same toolchain is used to build Boost, Ogre and my app (I tried GCC 4.6 and 4.7). I also verified that everything is built for the same target platform (android-9).

Any ideas?

I will probably rebuild Ogre with debugging information and try to find the cause, but maybe someone else already knows...

[SOLVED] Re: Crash on Android with OGRE_THREAD_SUPPORT=2 on

Posted: Sun Jun 16, 2013 12:33 am
by robert82h
Got it :-)
Turning on debug symbols revealed that it crashed in the compiler library at gcc-4.7/libgcc/config/arm/linux-atomic-64bit.c line 64. Somehow the threading code in Ogre (or Boost) triggers this function.

Code: Select all

/* Check that the kernel has a new enough version at load.  */
static void __check_for_sync8_kernelhelper (void)
{
  if (__kernel_helper_version < 5)
    {
      const char err[] = "A newer kernel is required to run this binary. "
                                "(__kernel_cmpxchg64 helper)\n";
      /* At this point we need a way to crash with some information
         for the user - I'm not sure I can rely on much else being
         available at this point, so do the same as generic-morestack.c
         write () and abort ().  */
#if !defined(__ANDROID__)
      __write (2 /* stderr.  */, err, sizeof (err));
#else
      write (2 /* stderr.  */, err, sizeof (err));
#endif
      abort ();                    //<<<-  CRASH LOCATION
    }
};
So it seems like the Galaxy Nexus' kernel has a kernel helper version < 5, while the Nexus 10 has a higher version. I found this bug which is somewhat related: code . google . com/p/android/issues/detail?id=41297 . Andrew's comment helped a lot: I was compiling Ogre with ANDROID_ABI=armeabi and Boost with default settings, so the code took the ARMv5 path. By using armeabi-v7a and removing some defines, the "dmb" instruction supported by ARMv7 is used.

I'm not sure who's to blame here and how to fix this issue properly so ARMv5 code does not crash on an up-to-date Galaxy Nexus. Compiling for armeabi-v7a is a decent workaround, though.

Required changes to Boost:

Code: Select all

diff --git a/build-android.sh b/build-android.sh
index 07f2381..a80bc6c 100755
--- a/build-android.sh
+++ b/build-android.sh
@@ -184,8 +184,8 @@ case "$NDK_RN" in
                CXXPATH=$AndroidNDKRoot/toolchains/arm-linux-androideabi-4.6/prebuilt/$Platfrom/bin/arm-linux-androideabi-g++
                TOOLSET=gcc-androidR8b
                ;;
-       8e)
-               CXXPATH=$AndroidNDKRoot/toolchains/arm-linux-androideabi-4.6/prebuilt/$Platfrom/bin/arm-linux-androideabi-g++
+       8e*)
+               CXXPATH=$AndroidNDKRoot/toolchains/arm-linux-androideabi-4.7/prebuilt/$Platfrom/bin/arm-linux-androideabi-g++
                TOOLSET=gcc-androidR8e
                ;;
        *)
diff --git a/configs/user-config-boost-1_53_0.jam b/configs/user-config-boost-1_53_0.jam
index 666d4c8..4ce1a79 100644
--- a/configs/user-config-boost-1_53_0.jam
+++ b/configs/user-config-boost-1_53_0.jam
@@ -95,12 +95,8 @@ arm-linux-androideabi-g++
 <compileflags>-fpic
 <compileflags>-ffunction-sections
 <compileflags>-funwind-tables
-<compileflags>-D__ARM_ARCH_5__
-<compileflags>-D__ARM_ARCH_5T__
-<compileflags>-D__ARM_ARCH_5E__
-<compileflags>-D__ARM_ARCH_5TE__
 <compileflags>-Wno-psabi
-<compileflags>-march=armv5te
+<compileflags>-march=armv7-a
 <compileflags>-mtune=xscale
 <compileflags>-msoft-float
 <compileflags>-mthumb
Required changes to Ogre:

Code: Select all

diff -r eaf0dbe4975b CMake/toolchain/android.toolchain.cmake
--- a/CMake/toolchain/android.toolchain.cmake   Thu Jun 13 09:02:30 2013 +0200
+++ b/CMake/toolchain/android.toolchain.cmake   Sun Jun 16 01:21:30 2013 +0200
@@ -787,8 +787,8 @@
  # NDK also defines -ffunction-sections -funwind-tables but they result in worse OpenCV performance
  set( CMAKE_CXX_FLAGS "-fPIC -Wno-psabi" )
  set( CMAKE_C_FLAGS "-fPIC -Wno-psabi" )
- remove_definitions( -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ )
- add_definitions( -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ )
+# remove_definitions( -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ )
+# add_definitions( -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ )
  # extra arm-specific flags
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fsigned-char" )
 elseif( X86 )
Configure like this:

Code: Select all

cmake -DCMAKE_TOOLCHAIN_FILE="`pwd`/../CMake/toolchain/android.toolchain.cmake" -DOGRE_DEPENDENCIES_DIR="`pwd`/../AndroidDependencies" -DANDROID_ABI=armeabi-v7a -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.7 -DBoost_COMPILER=-gcc ..

Re: Crash on Android with OGRE_THREAD_SUPPORT=2 on Galaxy Ne

Posted: Sun Jun 16, 2013 9:40 am
by c6burns
Interesting find. I have a Galaxy Nexus, but I don't target armv5.

To put things in perspective, the Galaxy Nexus is a cortex-a9. The previous generation was the Nexus S, a cortex-a8. The previous generation was the Nexus One, using some qualcomm chip I can't remember. Not one of those devices is armv5. All armv7. Of course, you may have to target armv5 for your app. I luckily don't for mine.

Re: Crash on Android with OGRE_THREAD_SUPPORT=2 on Galaxy Ne

Posted: Sun Jun 16, 2013 3:21 pm
by robert82h
AFAIR the Nexus One and its sibling HTC Desire were one of the first devices to support ARMv7 (including Neon support). There's a list of ARMv5/6/7 devices at forum . xda-developers . com/showthread.php?t=1596800, it seems like virtually all current devices are v7. I remember some early Tegra devices (Tegra 1 and 2) were v7 but didn't support the NEON extensions, however ARMv7 code without NEON should run fine on all hardware with decent GLES2 support.