floooh / sokol

minimal cross-platform standalone C headers
https://floooh.github.io/sokol-html5
zlib License
6.54k stars 469 forks source link

support arm64-v8a - INSTALL_FAILED_NO_MATCHING_ABIS #1019

Closed eam closed 3 months ago

eam commented 3 months ago

Hi, relative newbie WRT android development so apologies in advance if I'm missing something obvious.

I've successfully built and run sokol-samples/triangle-glfw for linux-make-debug I can also build sokol-samples/triangle-sapp for sapp-android-make-debug, but adb install fails:

adb: failed to install ./sapp-android-make-debug/sapp/triangle-sapp.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]

I believe this is because only 32bit armeabi-v7a objects are generated, and my phone (pixel8) is arm64-v8a:

$ file lib/armeabi-v7a/libtriangle-sapp.so
lib/armeabi-v7a/libtriangle-sapp.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=7305bf118b322127895e37407f73084504f97987, with debug_info, not stripped

I did try setting ANDROID_ABI: arm64-v8a in configs/android-make-debug.yml and this did not work - GLuint was undefined in sokol_gfx.h and I haven't yet looked further into why.

floooh commented 3 months ago

Hmm, I haven't run into this issue yet (I have a Google Pixel 4a with a somewhat recent Android).

One thing you could try is also changing to a more recent platform than android-28 (e.g. the default config looks like this currently:

https://github.com/floooh/fips/blob/55f8f170f569aa7ed4cb517288672c21d290567f/configs/android-make-release.yml#L7-L9

If sokol_gfx.h fails with an undefined GL type, it looks like it's skipping the include here (maybe SOKOL_GLES3 is not defined?):

https://github.com/floooh/sokol/blob/7f7cd64c6d9d1d4ed08d88a3879b1d69841bf0a4/sokol_gfx.h#L4351-L4355

floooh commented 3 months ago

PS: I actually tried the following which worked on my phone:

In the sokol-samples repository, change this line to ANDROID_ABI: arm64-v8a (alternatively in all other sapp-android-* configs.

https://github.com/floooh/sokol-samples/blob/2a74ef5905fe7841eaae6a70248d45ebed275fcc/fips-files/configs/sapp-android-make-debug.yml#L9

...then in the sokol-samples root directory (with your Android phone connected):

./fips clean all
./fips set config sapp-android-make-debug
./fips gen
./fips make clear-sapp
./fips run clear-sapp

I think compilation failed because you changed the 'raw' config file in the fips directory, not the project-specific build configs files in the sokol-samples project.

eam commented 3 months ago

I was able to try those steps today and it worked - thank you for all the pointers! My fault for not reading far enough into how fips works. I have enough to iterate on now. Thanks again!

floooh commented 3 months ago

Good to know, I wonder if it's time to generally switch to 64-bit ARM in the default fips build configs and fade out 32-bit support.