Skip to content

[BUG] Android 5 devices crashing with UnsatisfiedLinkError libcurl.so #112

Description

@bigahega

Describe the bug
Wanted to use the new native library dependencies but apparently Android 5 devices are not happy with this and they are all crashing.

To Reproduce
build.gradle

implementation 'com.android.ndk.thirdparty:openssl:1.1.1g-alpha-1'
implementation 'com.android.ndk.thirdparty:curl:7.69.1-alpha-1'

CMakeLists.txt

find_package(curl REQUIRED CONFIG)
...
target_link_libraries(
        ...
        curl::curl
)

Kt side:

    init {
        try {
            System.loadLibrary("mylib")
        } catch (ignored: UnsatisfiedLinkError) {
            ReLinker.loadLibrary(context, "mylib")
        }
    }

Release build (app bundle)
Android 5 devices: Crash.

Expected behavior
Should not crash like the rest of the Android 6-10 versions?

Logs

dlopen failed: cannot locate symbol "OpenSSL_version_num" referenced by "libcurl.so"
java.lang.Runtime.load (Runtime.java:331)
java.lang.System.load (System.java:981)
com.getkeepsafe.relinker.SystemLibraryLoader.loadPath (SystemLibraryLoader.java:29)
com.getkeepsafe.relinker.ReLinkerInstance.loadLibraryInternal (ReLinkerInstance.java:204)
com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary (ReLinkerInstance.java:136)
com.getkeepsafe.relinker.ReLinker.loadLibrary (ReLinker.java:70)
com.getkeepsafe.relinker.ReLinker.loadLibrary (ReLinker.java:51)
*.<init> (*.java:*)

Environment:
Prefab version:

android.enablePrefab=true
android.prefabVersion=1.1.0

Target OS version: Android 5
Build system: macOS Catalina

Additional context
All Android 5.0 - 5.1 - 5.1.1 versions are crashing. No other crash report received from higher versions.
Some crashing devices:
Huawei Y6 Pro
Samsung J3 (2016)
Samsung Note 3
Samsung Galaxy Grand Prime

Is it stated in somewhere that API 21-22 is not supported in these openssl / lib curl releases or am I missing something here?

Also it would be lovely to be able to use the OpenSSL without libcurl.

Activity

  1. self-assigned this
    on Jul 28, 2020
  2. DanAlbert commented on Jul 28, 2020

    @DanAlbert
    Contributor

    Interesting. I'll try to find some time to take a look, but unfortunately I have quite a few other things I need to clear off my todo list before I can put much time into these packages.

    Also it would be lovely to be able to use the OpenSSL without libcurl.

    Why can't you?

  3. bigahega commented on Jul 29, 2020

    @bigahega
    Author

    Also it would be lovely to be able to use the OpenSSL without libcurl.

    Why can't you?

    Well I don't wanna digress from the original problem here but about that, as far as I remember when I tried adding only the openssl dependency and openssl::openssl instead of the curl::curl, I wasn't able to compile it because of a linker error complaining about openssl. However, adding the libcurl dependency and linking with libcurl instead of the openssl was alright. I will give it another shot and add some more details about the error when I have some spare time.

  4. DanAlbert commented on Jul 29, 2020

    @DanAlbert
    Contributor

    File another bug for that if you have more info. I haven't actually tried doing that afair but I would expect it to work.

  5. DanAlbert commented on Aug 21, 2020

    @DanAlbert
    Contributor

    The libcrypto.so in the OpenSSL package definitely has that symbol.

    IIRC before M system libraries would be loaded preferentially to libraries in the app if they had the same name, so we're getting /system/lib/libcrypto.so instead of the one in the app :(

    Will need to think about how to solve that. Presumably just by making sure every library gets an _ndkports suffix or something like that.

  6. xbowen1 commented on Nov 12, 2020

    @xbowen1

    +1 on this issue.
    got exactly same error on FireTV sticker (second generation) api level 22 and any Android 5 emulator.

  7. added a commit that references this issue on Nov 24, 2021
  8. weikano commented on Apr 29, 2022

    @weikano

    any progress on this issue?

  9. DanAlbert commented on Apr 29, 2022

    @DanAlbert
    Contributor

    No. We'll post an update when we have progress, but we're currently busy with other issues.

  10. added
    ndkportsNot a Prefab bug, but we don't have a better home for these
    on May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingndkportsNot a Prefab bug, but we don't have a better home for these

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions