Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup fails on android: Unable to load native library libmain.so after spidermonkey upgrade #6432

Closed
mbrubeck opened this issue Jun 19, 2015 · 7 comments

Comments

@mbrubeck
Copy link
Contributor

@mbrubeck mbrubeck commented Jun 19, 2015

#6150 caused Servo to crash at startup on Android with java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.native_activity/rust.glutin.MainActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/data/com.example.native_activity/lib/libmain.so.

dlerror returns Cannot load library: reloc_library[1331]: 3020 cannot locate '_ZN2js6detail16ScrambleHashCodeEj'.

@michaelwu
Copy link
Contributor

@michaelwu michaelwu commented Jun 19, 2015

This might be similar to the CEF issue - the linker is looking for symbols that don't exist. Except Android is doing it at dynamic link time.

@mbrubeck
Copy link
Contributor Author

@mbrubeck mbrubeck commented Jun 20, 2015

Probably related to servo/rust-mozjs#158

@mbrubeck mbrubeck added the I-bustage label Jun 20, 2015
@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Jul 30, 2015

Interestingly, many of the references symbols from jsapi.rs do not even exist in libmozjs.a built for Android. The one here is a great example - at least according to nm, there are no symbols in the binary related to either Scramble or HashCode.

@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Jul 31, 2015

Even more strangely, even if you manually remove the missing ones, it's not finding matching ones. e.g., _ZN2js2gc26MarkPersistentRootedChainsEP8JSTracer is exported by libmozjs.so but attempting to load libmain.so gives an error that exactly that symbol is missing. :-/

(even when you do the goofball Android "dlopen the dependencies first" trick)

@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Jul 31, 2015

Aha! These symbols appear to be intentionally marked hidden by the SM build. Output from objdump: 001aa89c l F .text 000000ec .hidden _ZN2js2gc26MarkPersistentRootedChainsEP8JSTracer

Seems intentional (there are a bunch of GCC directives in the SM build to enable the pragmas to make them invisible).

@michaelwu @jdm Should I remove all of the symbols that are in rust-mozjs/jsapi.rs that are supposed to be hidden and not called from external functions? It's not clear that they would work if we attempted to call into them now, but as far as I can see we're just lucky because they're delayloaded on other platforms and we never attempt to call the Rust hooks.

I could be interpreting this incorrectly, though.

@michaelwu
Copy link
Contributor

@michaelwu michaelwu commented Jul 31, 2015

Yeah, that's the problem here. I'd like to fix bindgen to correctly figure out what symbols are actually visible. If you've successfully done it manually though, I don't mind landing the manual fix.

@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Aug 5, 2015

This issue is fixed in servo/rust-mozjs#181. I'll pick that up when I have fixes for the rest of the Android issues.

bors-servo pushed a commit that referenced this issue Aug 6, 2015
Update submodules and don't call setrlimit on Android

r? @mbrubeck 

Fixes #6432.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7051)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this issue Aug 8, 2015
Update submodules and don't call setrlimit on Android

r? @mbrubeck 

Fixes #6432.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7051)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.