rolandoam / spidermonkey

clone from the hg repo - only the necessary stuff to build the iOS and Android version
http://hg.mozilla.org/mozilla-central/
Other
28 stars 8 forks source link

Having trouble getting android to work #2

Closed mschulkind closed 12 years ago

mschulkind commented 12 years ago

@folecr maybe you know what I'm doing wrong?

I modified the script for my paths and platforms, you can see the changes here: https://github.com/mschulkind/spidermonkey/commit/2d24ad6bc9c40452bf3addf306929d500935fcbb

This is how I've tried integrating spidermonkey into my own project: https://github.com/mschulkind/cordova-true-native-android/commit/c4c81a322ee616c86be0e9ca86b65bfc3dabe869

No matter what I do, I get this when running the app:

D/dalvikvm(  554): Trying to load lib /data/data/org.apache.cordova.plugins.truenative.example/lib/libgnustl_shared.so 0x405135e8
D/dalvikvm(  554): Added shared lib /data/data/org.apache.cordova.plugins.truenative.example/lib/libgnustl_shared.so 0x405135e8
D/dalvikvm(  554): No JNI_OnLoad found in /data/data/org.apache.cordova.plugins.truenative.example/lib/libgnustl_shared.so 0x405135e8, skipping init
D/dalvikvm(  554): Trying to load lib /data/data/org.apache.cordova.plugins.truenative.example/lib/libSMRuntime.so 0x405135e8
I/DEBUG   (   31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (   31): Build fingerprint: 'generic/sdk/generic:2.3.3/GRI34/101070:eng/test-keys'
I/DEBUG   (   31): pid: 554, tid: 554  >>> org.apache.cordova.plugins.truenative.example <<<
I/DEBUG   (   31): signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 80824dfe
I/DEBUG   (   31):  r0 00000000  r1 0000000a  r2 00000438  r3 002aa112
I/DEBUG   (   31):  r4 80acd524  r5 00000009  r6 00000004  r7 00000000
I/DEBUG   (   31):  r8 80017f40  r9 0000ce48  10 418fcc20  fp 43ed8c74
I/DEBUG   (   31):  ip 80800000  sp beced088  lr b00037f5  pc 80824dfe  cpsr 40000030
I/DEBUG   (   31):          #00  pc 00024dfe  /data/data/org.apache.cordova.plugins.truenative.example/lib/libSMRuntime.so
I/DEBUG   (   31):          #01  lr b00037f5  /system/bin/linker
I/DEBUG   (   31): 

I've also tried using the spidermonkey provided by the couchdb guys with the exact same results.

folecr commented 12 years ago

The message about "No JNI_OnLoad" is not an error, its a warning. In general the JNI_OnLoad is where you would cache the VM pointer and do JNI housekeeping, etc.

BTW, I have a full-fledged Android app that uses the spidermonkey static library:

It might be helpful as a how-to.

To find out where the SIGILL is coming from, build in debug mode and use the ndk-stack utility so you can see which line of the code is causing it.

It looks like there are some assert()'s in your code : perhaps one of them is being triggered?

mschulkind commented 12 years ago

Looks like I spoke to soon. Switching to your spidermonkey version and using a newer emulator fixed it! Thanks for the great work; this will make my life a whole lot easier.

mschulkind commented 12 years ago

Thanks for the quick response.

It looks like it's just a broken emulator image version. WebView.addJavascriptInterface() is broken as well. If you notice, it's actually a SIGILL while loading the .so that links in libjs_static.a. The line you're looking at is from the gnustl lib. The puzzling part was that it happened inside loading the lib, not executing my code. There wasn't even a stack trace to symbolize in the crash output.

folecr commented 12 years ago

I haven't looked at all your build files etc. so this is just a guess : Perhaps it was the wrong ABI?

http://groups.google.com/group/android-ndk/browse_thread/thread/81f2917d3439d8b3

mschulkind commented 12 years ago

I was using the ARM 2.3.3 image which didn't work (x86 doesn't even attempt to load the lib for obvious reasons). It works on the 4.0.3 emulator image and my 2.3.7 device, so I don't think it's an ABI thing. Moral of the story is that it works now though :)

On Thu, Apr 12, 2012 at 8:51 PM, folecr < reply@reply.github.com

wrote:

I haven't looked at all your build files etc. so this is just a guess : Perhaps it was the wrong ABI?


Reply to this email directly or view it on GitHub: https://github.com/funkaster/spidermonkey/issues/2#issuecomment-5106427