Skip to content

fix: drop -Wl,--no-undefined from Android shim build #55

Merged
SineVector241 merged 2 commits intoAvionBlock:masterfrom
towneh:master
Apr 11, 2026
Merged

fix: drop -Wl,--no-undefined from Android shim build #55
SineVector241 merged 2 commits intoAvionBlock:masterfrom
towneh:master

Conversation

@towneh
Copy link
Copy Markdown
Contributor

@towneh towneh commented Apr 11, 2026

Summary

Follow-up to the previous -lm fix. The -Wl,--no-undefined guard I added as belt-and-braces exposed a pre-existing latent bug in upstream libopus's ARM DNN dispatch
table
, breaking the armeabi-v7a CI job:

ld.lld: error: undefined symbol: compute_activation_c

▎ ▎ ▎ referenced by arm_dnn_map.c:55 ... in archive libopus.a
▎ ▎ ▎ ld.lld: error: undefined symbol: compute_activation_neon
▎ ▎ ▎ ld.lld: error: undefined symbol: compute_conv2d_c
▎ ▎ ▎ ld.lld: error: undefined symbol: compute_conv2d_neon

opus/dnn/arm/arm_dnn_map.c unconditionally references both C and NEON variants of the DNN compute functions. On arm64 those definitions are unconditional (NEON is
mandatory on AArch64), so the link succeeds. On armeabi-v7a they're gated behind a NEON feature detection that doesn't fire correctly for the Android arm32 build, so
the symbols are never compiled.

Before my previous PR, these unresolved references were silently tolerated by the linker and left as undefined entries in the dynamic symbol table — a latent bug that
would only blow up at dlopen time if the DRED / deep-PLC code path was exercised on arm32. --no-undefined promoted that latent breakage into a hard link error.

Fixing the upstream xiph/opus feature-detection is out of scope for this repo. The pragmatic move is to drop the guard and restore the arm32 build to its previous
(working-for-practical-purposes) state. The -lm fix — which is the actual root cause of the Unity IL2CPP DllNotFoundException on arm64 devices — is retained.

Changes

  • Remove -Wl,--no-undefined from the Android "Build with shim" link step.
  • Keep -lm (unchanged from the previous PR).

Follow-up (not in this PR)

Upstream xiph/opus should be reported for the arm_dnn_map.c armeabi-v7a symbol gap — the map file should #ifdef its entries the same way the definitions are gated.
Out of scope here.

The --no-undefined guard added alongside -lm exposed a pre-existing bug in
upstream libopus's ARM DNN dispatch table: opus/dnn/arm/arm_dnn_map.c
unconditionally references compute_activation_{c,neon} and
compute_conv2d_{c,neon}, but on armeabi-v7a those definitions are gated
behind a NEON feature detection that does not fire for the Android arm32
build, so the symbols are never compiled. arm64 is unaffected because NEON
is mandatory on AArch64.

Previously these unresolved references were silently tolerated by the
linker and left as undefined symbols in the .so (a latent bug that would
only surface at dlopen time if the DRED/deep-PLC code path was exercised).
--no-undefined promoted them to hard link errors and broke the arm32 job.

Drop the guard to restore the arm32 build. The -lm fix — which is the
actual root cause of the original Unity IL2CPP DllNotFoundException on
arm64 — is retained.
@towneh
Copy link
Copy Markdown
Contributor Author

towneh commented Apr 11, 2026

image

…ndroid

Regenerates and replaces every prebuilt native binary under
OpusSharp.Natives/runtimes:

- android-arm, android-arm64, android-x64, android-x86 (libopus.so)
- linux-arm, linux-arm64, linux-x64, linux-x86 (opus.so)
- osx-arm64, osx-x64 (opus.dylib)
- win-arm64, win-x64, win-x86 (opus.dll)
- ios/libopus.xcframework (device + simulator static libs, headers,
  Info.plist, and the meson.build header-bundle descriptors)

The primary motivation is fixing the Android arm64 libopus.so. The
previous binary was compiled without linking libm, so its DT_NEEDED
list contained only libdl.so and libc.so. On device the Android
dynamic linker refused to load it the moment a managed caller tried
to construct an OpusEncoder or OpusDecoder, and the failure surfaced
through P/Invoke as the generic

  DllNotFoundException: Unable to load DLL 'opus'
  dlopen failed: library "opus" not found

making it look like the file was missing from the APK when in fact it
was present and correctly placed in lib/arm64-v8a/. The rebuilt arm64
binary now declares libm.so as NEEDED alongside libdl.so and libc.so,
satisfying every math symbol opus pulls in from the C runtime and
allowing the library to load successfully on Android.

All other runtimes are regenerated from the same build run so every
platform ships a matching version of the underlying opus codec and
associated shim exports, rather than mixing old binaries with the new
Android build.
Copy link
Copy Markdown
Member

@SineVector241 SineVector241 left a comment

Choose a reason for hiding this comment

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

Werk

@SineVector241 SineVector241 merged commit 56bfee7 into AvionBlock:master Apr 11, 2026
4 checks passed
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