Bundling an Android Static Library for a Defold Native Extension

I have a library project that I’m building into static libs for use in a Defold native extension. I managed to build/bundle it for every platform except Android.

I’m using Defold’s workflow: github-actions-common/.github/workflows/bob.yml at master · defold/github-actions-common · GitHub to build and bundle.

Error: workflow · selimanac/defold-graph-pathfinder@11e5efe · GitHub


2025-10-22 13:13:20 INFO    Copying engine to /home/runner/work/defold-graph-pathfinder/defold-graph-pathfinder/build/default/defoldgraphpathfinder/aab/base/lib/arm64-v8a/libdefoldgraphpathfinder.so

2025-10-22 13:13:20 INFO    exec: /tmp/12934738519295538546/x86_64-linux/strip_android_aarch64 /home/runner/work/defold-graph-pathfinder/defold-graph-pathfinder/build/default/defoldgraphpathfinder/aab/base/lib/arm64-v8a/libdefoldgraphpathfinder.so

ERROR: unspecified:-1: ‘com.dynamo.bob.CompileExceptionError: Failed creating AAB base.zip’

2025-10-22 13:13:20 SEVERE  Failed creating AAB base.zip
2025-10-22 13:13:20 SEVERE  Cause:0: java.lang.RuntimeException: location /tmp/12934738519295538546/x86_64-linux/lib not found

Looks like strip_android_aarch64 doesn’t like it. Also lib is not .so but .a (libGraphPathfinder.a) ?

This is my CMake. I had to add -Xclang -no-opaque-pointers to build with 14.0.6 and tried to strip symbols using -s, but that isn’t working either.

if(ANDROID)

    # -Xclang -no-opaque-pointers for Defold extender (LLVM 14.0.6)
    add_compile_options(-Xclang -no-opaque-pointers)
    
    #  Strip symbols during build but no luck
    add_link_options(-s)
    
    add_compile_options(-fvisibility=hidden)
    
    add_compile_options(-fvisibility-inlines-hidden)
endif()

I’m using ndk-version: r26d for building (Github CI)

Probably I’m missing something… Any suggestions?

Hmm, I guess somehow bob’s --strip-executable might be causing this.
It works for ios but not for android. I have no clue, I already tried with and without -s.

When running the android tools we also set the LD_LIBRARY_PATH like this:

Could it be that this path doesn’t exist?

Might be, but this is built using Defold’s workflow by CI: github-actions-common/.github/workflows/bob.yml at master · defold/github-actions-common · GitHub.
Any idea how I can set it, or what it might be on the server?

Maybe @ekharkunov could help, I’d really appreciate it if you could take a look when you have some time.

1 Like

Could it be that this path doesn’t exist?

Yes, folder doesn’t exist. Bob unpacks executables from libexec but doesn’t unpack lib folder.

If run strip command from command line with non-exist LD_LIBRARY_PATH - command completes successfully.

Might be, but this is built using Defold’s workflow by CI: github-actions-common/.github/workflows/bob.yml at master · defold/github-actions-common · GitHub .
Any idea how I can set it, or what it might be on the server?

I don’t understand why any of our inner builds didn’t fail because they should fail with the same error. For example, here Update sdk to 5.0.13 version. Add support for Web (#3) · defold/extension-photon-realtime@e68c0ba · GitHub

I’m probably missing something when building this library for Android.
All other platforms build and bundle just fine, and Android also builds without issues, it only fails during the release bundle. Honestly, I have no idea too.

I tried to build locally Photon realtime and got the same error as you. But on CI it didn’t fail. Hmm….

1 Like

I didn’t try building it locally yet since I wasn’t expecting any difference. I’ll give it a try tomorrow. Thanks for looking out.

@ekharkunov Interestingly, it works for me using 1.11.2 (c3a3c). I bundled it from the Editor for Android, and it runs fine on the device :slightly_smiling_face:. I’m going to try using Bob next , still no idea why the bundle fails on CI.

I’ve created an issue Bob failed to bundle Android (`strip` command) · Issue #11423 · defold/defold · GitHub

3 Likes

Thank you

1 Like

I see that this is fixed, thanks to @AGulev , it now builds and bundles for armv7 successfully.
However, it’s no longer building for arm64. This might be on my side; I’m going to try rebuilding the library, but what might be causing libGraphPathfinder.a: unknown file type?

ERROR: graph_pathfinder/ext.manifest:1: '/tmp/job17793493335488322848/upload/graph_pathfinder/lib/arm64-android/libGraphPathfinder.a: unknown file type'

(I guess it is because I was aggressively stripping the lib to prevent prev error)

2 Likes

Yes, it was my aggressive stripping. All build/bundle just fine now.
Thanks again @ekharkunov @AGulev

6 Likes