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. #3184

Merged
merged 3 commits into from
Oct 16, 2023

Conversation

gsfare
Copy link
Contributor

@gsfare gsfare commented Oct 16, 2023

The issue for this PR is tracked here,

#3183

This PR adds the correct SONAME for the target dynamic libraries for Android so the dynamic linker can search the default paths for shared libraries instead of a fixed path.

Below is the output from readelf showing correct embedding of SONAME.

[garethf@fedora bgfx]$ ls -l .build/android-arm64/bin/.so
-rwxr-xr-x. 1 garethf garethf 5469048 Oct 16 15:55 .build/android-arm64/bin/libbgfx-shared-libDebug.so
-rwxr-xr-x. 1 garethf garethf 7742072 Oct 16 15:56 .build/android-arm64/bin/libbgfx-shared-libRelease.so
-rwxr-xr-x. 1 garethf garethf 11408680 Oct 16 15:55 .build/android-arm64/bin/libexample-17-drawstressDebug.so
-rwxr-xr-x. 1 garethf garethf 2912776 Oct 16 15:56 .build/android-arm64/bin/libexample-17-drawstressRelease.so
-rwxr-xr-x. 1 garethf garethf 5692936 Oct 16 15:55 .build/android-arm64/bin/libexample-25-c99Debug.so
-rwxr-xr-x. 1 garethf garethf 1240888 Oct 16 15:56 .build/android-arm64/bin/libexample-25-c99Release.so
-rwxr-xr-x. 1 garethf garethf 15592688 Oct 16 15:55 .build/android-arm64/bin/libexamplesDebug.so
-rwxr-xr-x. 1 garethf garethf 3750264 Oct 16 15:57 .build/android-arm64/bin/libexamplesRelease.so
[garethf@fedora bgfx]$ readelf --dynamic .build/android-arm64/bin/
.so | grep SONAME
0x000000000000000e (SONAME) Library soname: [libbgfx-shared-libDebug.so]
0x000000000000000e (SONAME) Library soname: [libbgfx-shared-libRelease.so]
0x000000000000000e (SONAME) Library soname: [libexample-17-drawstressDebug.so]
0x000000000000000e (SONAME) Library soname: [libexample-17-drawstressRelease.so]
0x000000000000000e (SONAME) Library soname: [libexample-25-c99Debug.so]
0x000000000000000e (SONAME) Library soname: [libexample-25-c99Release.so]
0x000000000000000e (SONAME) Library soname: [libexamplesDebug.so]
0x000000000000000e (SONAME) Library soname: [libexamplesRelease.so]
[garethf@fedora bgfx]$ ls

… can dynamically resolve the library location from known locations (as opposed to a hard coded location often residing on the host cross compiling filesystem.

linked issue is,

bkaradzic#2176
links {
"EGL",
"GLESv2",
}

configuration { "android*", "Debug" }
linkoptions {
"-shared -Wl,-soname,lib" .. project().name .. "Debug.so"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should keep this separate.
Leave linkoptions { "-shared" } above, and add these new options without it below.

@bkaradzic bkaradzic merged commit 7c440b3 into bkaradzic:master Oct 16, 2023
jay3d pushed a commit to jay3d/bgfx that referenced this pull request Dec 7, 2023
…zic#3184)

* Add linker options to add SONAME to the linked target so Android apps can dynamically resolve the library location from known locations (as opposed to a hard coded location often residing on the host cross compiling filesystem.

linked issue is,

bkaradzic#2176

* Kepp orginal code for linkoptions in the previous configuration block and add the additional linker flags for each Debug/Release configuration.

* Add comma character to EOL to match orginal code.
mipek pushed a commit to mipek/bgfx that referenced this pull request Mar 2, 2024
…zic#3184)

* Add linker options to add SONAME to the linked target so Android apps can dynamically resolve the library location from known locations (as opposed to a hard coded location often residing on the host cross compiling filesystem.

linked issue is,

bkaradzic#2176

* Kepp orginal code for linkoptions in the previous configuration block and add the additional linker flags for each Debug/Release configuration.

* Add comma character to EOL to match orginal code.
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

Successfully merging this pull request may close these issues.

None yet

2 participants