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 Linker cannot handle lib path suffix below Android M #49

Open
alhah opened this issue Aug 7, 2018 · 5 comments
Open

Android Linker cannot handle lib path suffix below Android M #49

alhah opened this issue Aug 7, 2018 · 5 comments

Comments

@alhah
Copy link

alhah commented Aug 7, 2018

We meet error like this:

java.lang.UnsatisfiedLinkError
dlopen failed: could not load library "libmegface-new.so" needed by "libMegviiFacepp-0.5.2.so.6453"; caused by library "libmegface-new.so" not found

Android Linker below M use exactly match to handle dependency. In our case, libMegviiFacepp-0.5.2.so depends on libmegface-new.so, and they were renamed to libMegviiFacepp-0.5.2.so.6453 & libmegface-new.so.6453. When linker load libMegviiFacepp-0.5.2.so.6453, it would try to load libmegface-new.so first, and then failed.

We pass "null" for "version" below Android M to avoid this.

@philippb
Copy link
Contributor

Could you please add more specific steps to reproduce this. That would be very helpful.

@alhah
Copy link
Author

alhah commented Sep 12, 2018

Suppose our app has a lib named "A.so", and it depends on "B.so" in Android.mk(LOCAL_SHARED_LIBRARIES += B), the version code is "1234", the reproduce steps:

  1. Find a rooted device below Android M and install the app.
  2. Delete "A.so" & "B.so" in the default lib directory such as "/data/app//lib/arm"
  3. Load "A.so", then relinker will decompress apk file and rename "A.so" to "A.so.1234", also with "B.so" to "B.so.1234".
  4. The bionic linker will read "DT_NEEDED" to look for "B.so", but there is only "B.so.1234", then throw UnsatisfiedLinkError.

Thank you.

@philippb
Copy link
Contributor

@alhah sorry for not seeing this earlier. Got lost in notifications storm.

Thanks for the reproduction steps. I'd love to get this handled better in ReLinked, but unfortunately we don't have the resources to do this right now. You think you'll be able to open a PR?
How would you think a fix would look like?

alhah added a commit to alhah/ReLinker that referenced this issue Mar 19, 2019
Signed-off-by: xueqiushi <[email protected]>
alhah added a commit to alhah/ReLinker that referenced this issue Mar 19, 2019
Signed-off-by: xueqiushi <[email protected]>
@emarc-m
Copy link
Contributor

emarc-m commented Dec 28, 2019

Hi @alhah, this issue only occurs for rooted phones?

@alhah
Copy link
Author

alhah commented Dec 30, 2019

@emarc-m It occurs for all phones below Android M, root just for explain the reproduce path. If A.so depends B.so which has been renamed to B.so.version_code, linker can not find it below Android M.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants