Skip to content

UnsatisfiedLinkError: empty/missing DT_HASH/DT_GNU_HASH #67

Closed
@KittyMac

Description

@KittyMac

I am attempting to use this toolchain to build a barebones SPM as a dynamic library and load it into an Android studio app. I have been able to set things up such that the SPM project builds + tests succeed + .so files are emitted in a Docker container. I then take the .so's out of the container (including all the dependent ones like libdispatch.so, libc++_shared.so etc) and drop them in a simple Android studio project and attempt to load at runtime using System.loadLibrary("Foundation"). I am using the prebuilts ( https://github.com/buttaface/swift-android-sdk/releases/tag/5.6 )

java.lang.UnsatisfiedLinkError: dlopen failed: empty/missing DT_HASH/DT_GNU_HASH in "/data/app/~~5NBdFZVd502EJ3UzvxTnEw==/com.chimerasw.silkroadandroidtest-ARbbTYafh-bWJrnSDReyTw==/base.apk!/lib/arm64-v8a/libdispatch.so" (new hash type from the future?)
        at java.lang.Runtime.loadLibrary0(Runtime.java:1077)
        at java.lang.Runtime.loadLibrary0(Runtime.java:998)
        at java.lang.System.loadLibrary(System.java:1656)

If I try and load just a single dependent .so (say just swiftCore) it loads fine.

I tried swapping out all of the .so with the toolchain built over at https://github.com/readdle/swift-android-toolchain, and System.loadLibrary("Foundation") loads fine.

I suspect its something just with libdispatch, but am unsure where to look further. Any advice on where I can look to see what might be up?

[edit]fwiw, i reproduce with just libdispatch.so and libBlocksRuntime.so and nothing else[/edit]

[edit2]If i use your 5.4 release and swap out the other projects libdispath.so, then libdispatch and libBlockRuntime load successfully. I suspect the step mentioned in the readme where you manually do something to libdispatch may be the reason[/edit2]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions