fix: link libm in Android shim build to resolve missing math symbols #54
Merged
SineVector241 merged 1 commit intoAvionBlock:masterfrom Apr 11, 2026
Merged
fix: link libm in Android shim build to resolve missing math symbols #54SineVector241 merged 1 commit intoAvionBlock:masterfrom
SineVector241 merged 1 commit intoAvionBlock:masterfrom
Conversation
The Android libopus.so was produced without -lm, so math functions used by CELT/SILK (sqrt, log, exp, etc.) ended up as unresolved symbols. On Android, libm is a separate shared object and bionic reports the resulting load failure as a generic 'library not found' error, which manifested in Unity IL2CPP as DllNotFoundException when initializing OpusEncoder/OpusDecoder on arm64 devices (e.g. Pixel 8 Pro). Add -lm to the Android shim link step (matching the Linux step) and -Wl,--no-undefined so any future missing dependency fails the build instead of silently producing a broken .so.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Android
libopus.sois currently produced without-lm, so math functions used by CELT/SILK (sqrt,log,exp, etc.) end up as unresolved symbols. On Android,libmis a separate shared object, and bionic reports the resulting load failure as a genericlibrary "opus" not founderror.In Unity IL2CPP this manifests as a
DllNotFoundExceptionthe momentOpusEncoder/OpusDecoderis constructed on arm64 devices — reproduced on a Pixel 8 Pro, but itaffects all Android arches produced by this workflow. The file is present in the APK and in the device's
nativeLibraryDir, the ELF is arm64 and 16 KB-page aligned,SONAME is clean — but
readelf -dshows onlyDT_NEEDED: libdl.so, libc.sowith nolibm.so, which is the smoking gun.The Linux shim step already passes
-lm; the Android step was simply missing it.Changes
-lmto the Android "Build with shim" link step, matching the Linux step.-Wl,--no-undefinedso any future missing dependency fails the GitHub Actions build loudly instead of silently producing a broken.sothat only fails atdlopentime on-device.