Skip to content

apk, built with openssl launch error: "libssl1.0.2h.so" not found #850

Closed

Description

@Fak3

Steps to reproduce:

Build distro with openssl:

p4a create --dist_name=testpygame --bootstrap=pygame --requirements=pygame,openssl,python2,kivy,pil,requests,plyer

Then build some apk with this distro.

Try to launch apk on the device. It fails to launch, and adb logcat python:* *:E reveals linker error:

E/Trace   (15822): error opening trace file: No such file or directory (2)
V/python  (15822): metadata fullscreen is1
E/linker  (15822): load_library(linker.cpp:759): library "libssl1.0.2h.so" not found
E/linker  (15822): soinfo_link_image(linker.cpp:1652): could not load library "libssl1.0.2h.so" needed by "libpython2.7.so"; caused by load_library(linker.cpp:759): library "libssl1.0.2h.so" not found
E/dalvikvm(15822): dlopen("/data/app-lib/org.spbelect.monarchy-2/libpython2.7.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1652): could not load library "libssl1.0.2h.so" needed by "libpython2.7.so"; caused by load_library(linker.cpp:759): library "libssl1.0.2h.so" not found
E/AndroidRuntime(15822): FATAL EXCEPTION: Thread-5955
E/AndroidRuntime(15822): java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_link_image(linker.cpp:1652): could not load library "libssl1.0.2h.so" needed by "libpython2.7.so"; caused by load_library(linker.cpp:759): library "libssl1.0.2h.so" not found

I am using p4a git master.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Activity

  1. Fak3 commented on Jul 22, 2016

    @Fak3
    ContributorAuthor

    I checked the /data/app-lib/org.spbelect.monarchy-2 dir on my android phone, and i have that library installed there

    1|u1@android:/data/app-lib/org.spbelect.monarchy-2 # ls -l                                                                                                                                                         
    -rwxr-xr-x system   system      13464 2016-08-21 20:53 libapplication.so
    -rwxr-xr-x system   system    1540604 2016-08-21 20:53 libcrypto1.0.2h.so
    -rwxr-xr-x system   system    2518340 2016-08-21 20:53 libpython2.7.so
    -rwxr-xr-x system   system     206364 2016-08-21 20:53 libsdl.so
    -rwxr-xr-x system   system     206160 2016-08-21 20:53 libsdl_image.so
    -rwxr-xr-x system   system      13432 2016-08-21 20:53 libsdl_main.so
    -rwxr-xr-x system   system     136496 2016-08-21 20:53 libsdl_mixer.so
    -rwxr-xr-x system   system     320780 2016-08-21 20:53 libsdl_ttf.so
    -rwxr-xr-x system   system     274152 2016-08-21 20:53 libsqlite3.so
    -rwxr-xr-x system   system    1596492 2016-08-21 20:53 libssl1.0.2h.so
    

    But somehow linker fails to load it.

  2. inclement commented on Jul 27, 2016

    @inclement
    Member

    I'm not sure what's wrong here, I'll try to test at the weekend. Thanks for reporting it.

  3. Fak3 commented on Aug 4, 2016

    @Fak3
    ContributorAuthor

    I tried to debug it a bit. When I launch python from data/data/org.spbelect.monarchy/lib, I get the same error:

    127|u1@android:/data/data/org.spbelect.monarchy/lib # ./libpython2.7.so
         soinfo_link_image(linker.cpp:1652): could not load library "libssl1.0.2h.so" needed by "./libpython2.7.so"; caused by load_library(linker.cpp:759): library "libssl1.0.2h.so" not found CANNOT LINK EXECUTABLE
    

    But when I set LD_LIBRARY_PATH=".", then the error disappears:

    255|u1@android:/data/data/org.spbelect.monarchy/lib # LD_LIBRARY_PATH="." ./libpython2.7.so
         Illegal instruction
    
  4. Fak3 commented on Aug 4, 2016

    @Fak3
    ContributorAuthor

    Fwiw I found p4a version that works for me:

    sudo pip2 install git+https://github.com/kivy/python-for-android/@c5f8340974094da2e6551f7c4925ff85da43bdd3 --upgrade --force-reinstall
    

    It points to commit right before the openssl recipe changes, and app launches correctly with it.

  5. inclement commented on Aug 31, 2016

    @inclement
    Member

    Sorry for the delay getting back to this, and thanks for isolating the problem. I'll try to take a look at this soon, maybe just by reverting the changes for now.

  6. Fak3 commented on Sep 26, 2016

    @Fak3
    ContributorAuthor

    One user reported that update from android 5 to android 6 broke my app. It does not launch anymore. I suspect that openssl removal in android 6 did that. But not sure though.

  7. Fak3 commented on Sep 26, 2016

    @Fak3
    ContributorAuthor

    Btw here is related thread from Qt, which has some interesting info: https://bugreports.qt.io/browse/QTBUG-49069

  8. brussee commented on Nov 28, 2016

    @brussee
    Contributor

    One user reported that update from android 5 to android 6 broke my app. It does not launch anymore. I suspect that openssl removal in android 6 did that. But not sure though.

    This is the reason I introduced versioning: there are different versions of openssl shipped with different versions of Android. The fact that it worked for you before is not consistent.
    This is indeed the solution in my opinion: #935 (comment)

  9. brussee commented on Nov 28, 2016

    @brussee
    Contributor

    From: https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client

    BoringSSL
    Android is moving away from OpenSSL to the BoringSSL library. If you’re using the Android NDK in your app, don't link against cryptographic libraries that are not a part of the NDK API, such as libcrypto.so and libssl.so. These libraries are not public APIs, and may change or break without notice across releases and devices. In addition, you may expose yourself to security vulnerabilities. Instead, modify your native code to call the Java cryptography APIs via JNI or to statically link against a cryptography library of your choice.

  10. Zen-CODE commented on Aug 22, 2017

    @Zen-CODE
    Member

    Yes, we are hitting this with the latest buildozer on Android 4.4.2 and previous. Newer versions work fine. Will experiment with loading order as suggested in some references comments.

  11. inclement commented on Jan 30, 2019

    @inclement
    Member

    Closing as stale, I believe this is currently working fine on the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions