mac.ma
mac.ma

Reputation: 713

Issue about using prebuilt third library inAndroid.bp

I have a library called libhelloworld.so built by NDK. Then I push it into /vendor/my/lib in ASOP and write a Android.bp in /vendor/my/ to integrate it:

cc_prebuilt_library_shared {
    name: "libhelloworld",
    vendor: true,
    srcs: ["lib/libhelloworld.so"],
}

mmm vendor/my/, this library will be generated into out/target/product/balabala/vendor/lib64/.

I write a native app to invoke this library:

cc_binary {
    name: "test_helloworld",
    vendor: true,
    srcs: [
        "test_helloworld.cpp",
    ],
    shared_libs: [
        "liblog",
        "libhelloworld",
    ],
}

mmm it, the test_helloworld will be generated into out/target/product/balabala/vendor/bin/.

However, when I use objdump -p test_helloworld, it shows below: NEEDED vendor/my/lib/libhelloworld.so which is not what I expect: NEEDED libhelloworld.so.

Anybody knows why?

Upvotes: 0

Views: 520

Answers (1)

mac.ma
mac.ma

Reputation: 713

The libhelloworld.so has no SONAME in its ELF. Fix this by adding -Wl,-soname,libhelloword.so

Upvotes: 1

Related Questions