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

Small fix on soname defining on ldflags for Android examples. #3183

Closed
gsfare opened this issue Oct 16, 2023 · 2 comments
Closed

Small fix on soname defining on ldflags for Android examples. #3183

gsfare opened this issue Oct 16, 2023 · 2 comments

Comments

@gsfare
Copy link
Contributor

gsfare commented Oct 16, 2023

This bug is similar to that which was fixed in this report,

#2176

Essentially it's regarding how the examples are built for Android and how to link them into an Android application. It can't be guaranteed which version of the Android NDK is being used and the SONAME should be defined in any d=shard library built for Android otherwise the runtime linker (using dlopen) will use the default path which is generally based upon the host cross-compile filesystem.

Here is a repo that reproduces the issue, it results in a linker error at runtime when the app is run on a Android device.

https://github.com/gsfare/bgfx-android-examples/tree/main

The error is below since the dynamic linker is trying to find the path for the library on the host machine rather than the device it's running on.

10-16 14:47:54.295 5043 5043 E AndroidRuntime: java.lang.UnsatisfiedLinkError: Unable to load native library "/data/app/~~i4NjwSJJQf-gkES-Ln5HAQ==/com.example.native_activity-1ubDSe4RYAA71-UBJ5O5iQ==/lib/arm64/libnative-activity.so": dlopen failed: library "/home/garethf/Development/bgfx-android-examples/native-activity/app/src/main/cpp/../../../../../bgfx/.build/android-arm64/bin/libexamplesRelease.so" not found: needed by /data/app/~~i4NjwSJJQf-gkES-Ln5HAQ==/com.example.native_activity-1ubDSe4RYAA71-UBJ5O5iQ==/lib/arm64/libnative-activity.so in namespace clns-4
I have a fix for this already, I just wanted to raise a ticket so it can be tracked/commented/discussed appropriately! I'll post a PR for this issue for review.

@bkaradzic
Copy link
Owner

Sure, send fix PR.

@gsfare
Copy link
Contributor Author

gsfare commented Oct 16, 2023

Here is the PR. Happy to change if needed. Just let me know.

#3184

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

2 participants