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

Android startup fails loading libmain.so due to OpenSSL library failure #5145

Closed
mbrubeck opened this issue Mar 4, 2015 · 4 comments · Fixed by #5784
Closed

Android startup fails loading libmain.so due to OpenSSL library failure #5145

mbrubeck opened this issue Mar 4, 2015 · 4 comments · Fixed by #5784
Labels
P-android Android devices

Comments

@mbrubeck
Copy link
Contributor

mbrubeck commented Mar 4, 2015

Since the latest Rust upgrade, Servo crashes on startup on Android with the following error:

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 the following in a small test program:

Loading library: Cannot load library: link_image[1916]: 5532 could not load needed library 'libandroid.so' for 'libmain.so' (link_image[1916]: 5532 could not load needed library 'libandroid_runtime.so' for 'libandroid.so' (link_image[1916]: 5532 could not load needed library 'libssl.so' for 'libandroid_runtime.so' (link_image[1916]: 5532 could not load needed library 'libcrypto.so.1.0.0' for 'libssl.so' (load_library[1118]: Library 'libcrypto.so.1.0.0' not found))))

The dynamic libraries mentioned above are all found in /system/lib except for libmain.so which is part of Servo and libcrypto.so.1.0.0 which does not exist. (There is only /system/lib/libcrypto.so. I'm not sure what is trying to use the versioned filename or why.)

We should be linking libssl and libcrypto statically on Android (sfackler/rust-openssl#119). Maybe our statically-linked versions are now conflicting somehow with the system version linked by libandroid_runtime.so?

@glennw
Copy link
Member

glennw commented Mar 4, 2015

Is strace available on android? It might show if it's trying to open those system libs and rejecting them?

@larsbergstrom larsbergstrom added the P-android Android devices label Mar 16, 2015
@mbrubeck
Copy link
Contributor Author

mwu suggested on IRC that we shouldn't be linking to libandroid.so at all, since the symbols it exposes are unstable and only meant to be used through JNI interfaces. When I modified Servo's linker arguments to remove -landroid, dlopen("libmain.so") with a different error:

Loading library: Cannot load library: link_image[1916]: 16623 could not load needed library 'libcrypto.so.1.0.0' for 'libmain.so' (load_library[1118]: Library 'libcrypto.so.1.0.0' not found)

@mbrubeck
Copy link
Contributor Author

There is a libcrypto.so.1.0.0 in the support/android/openssl-1.0.1k directory, but it's not included in the APK because it fails this test in apk-builder (the filename doesn't end in ".so").

@mbrubeck
Copy link
Contributor Author

We're no longer linking the OpenSSL libs statically because we don't set the new OPENSSL_STATIC variable added in sfackler/rust-openssl@c4f8427.

mbrubeck added a commit to mbrubeck/servo that referenced this issue Apr 22, 2015
Required by the latest version of the openssl-sys build script. Fixes servo#5145.
mbrubeck added a commit to mbrubeck/servo that referenced this issue Apr 22, 2015
Required by the latest version of the openssl-sys build script. Fixes servo#5145.
bors-servo pushed a commit that referenced this issue Apr 22, 2015
Required by the latest version of the openssl-sys build script. Fixes #5145.

r? @larsbergstrom or @glennw

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

Successfully merging a pull request may close this issue.

3 participants