Skip to content

ci: strip debug symbols from Android prebuilt SDK libraries - #702

Open
chinaux wants to merge 1 commit into
alibaba:mainfrom
chinaux:fix/strip-android-sdk-libs
Open

ci: strip debug symbols from Android prebuilt SDK libraries#702
chinaux wants to merge 1 commit into
alibaba:mainfrom
chinaux:fix/strip-android-sdk-libs

Conversation

@chinaux

@chinaux chinaux commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Problem

The Android prebuilt SDK asset in release builds is abnormally large: zvec-sdk-android-arm64.tar.gz is ~147 MB compressed and contains a ~500 MB libzvec.so, while all other platform packages are 20-38 MB.

Root cause

The NDK toolchain injects -g into all build types. In normal Android app builds AGP strips the .so files at APK packaging time, but _build_prebuilt.yml ships the raw .so files directly and has no strip step, so hundreds of MB of DWARF debug info end up in libzvec.so.

Fix

Add a strip step to the Android build job in .github/workflows/_build_prebuilt.yml, running over the staged libraries before packaging:

  • Uses the NDK's llvm-strip from $NDK/toolchains/llvm/prebuilt/linux-x86_64/bin
  • Falls back to llvm-objcopy --strip-all if llvm-strip is unavailable, and prints the NDK tool layout to aid debugging if neither is found

Verification

Built from my fork with this change (release run for tag v0.2.99-test2, since cleaned up):

  • libzvec.so: ~500 MB -> 29 MB
  • zvec-sdk-android-arm64.tar.gz: 153,829,823 B -> 24,304,754 B (-84%)
  • No size changes on other platform packages
  • The staged SDK still passes the existing cross-compile link smoke test

The NDK toolchain injects -g into all build types. AGP normally strips
the .so files at APK packaging time, but the prebuilt SDK ships them
directly, so libzvec.so carried hundreds of MB of DWARF debug info
(~500MB, 147MB compressed tar.gz).

Add a strip step to the Android build job that runs llvm-strip (with a
llvm-objcopy --strip-all fallback) over the staged libraries before
packaging.

Verified on the fork (v0.2.99-test2 build): libzvec.so ~500MB -> 29MB,
zvec-sdk-android-arm64.tar.gz 153.8MB -> 24.3MB (-84%), other platform
packages unchanged, and the staged SDK still passes the cross-compile
link smoke test.
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.

2 participants