Skip to content

gl-sdk: generate Kotlin bindings with a gobley build that fixes 32-bit ARM - #749

Open
angelix wants to merge 1 commit into
Blockstream:mainfrom
angelix:ave-gobley-arm32-fix
Open

angelix wants to merge 1 commit into
Blockstream:mainfrom
angelix:ave-gobley-arm32-fix

Conversation

@angelix

@angelix angelix commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #748.

Problem

On 32-bit ARM Android (armeabi-v7a), loading the gl-sdk Kotlin bindings throws UniFFI API checksum mismatch once the app is AOT-compiled. That covers release builds installed from Google Play (cloud profiles / background dexopt). Debug builds and plain adb installs run interpreted and don't hit it.

gobley 0.3.7 maps the FFI with JNA direct mapping and declares u8/u16 returns as Byte/Short. Rust zero-extends them, and ART's compiled JNI stubs on 32-bit ARM don't re-extend small return values. So, for example, uniffi_glsdk_checksum_func_parse_input reads as 0x0000C023 instead of -16349. This is gobley/gobley#252, the same bug uniffi fixed in mozilla/uniffi-rs#2740.

Change

task build:kotlin installs gobley-uniffi-bindgen from a pinned revision of https://github.com/angelix/gobley carrying the fix proposed upstream in gobley/gobley#297. That fix ports mozilla/uniffi-rs#2897 and #2935: u8/u16 returns are read as Int and narrowed, and checksums are compared masked to 16 bits.

Testing

Android 7.1.1 armeabi-v7a emulator, gl-sdk v0.3.0 built with cargo ndk -t armv7-linux-androideabi, bindings generated with the pinned gobley. The generated checksums match the published glsdk-android 0.3.0 (49/49).

com.blockstream.glsdk.IntegrityCheckingUniffiLib loaded via dalvikvm:

Bindings Interpreted AOT (--compiler-filter=speed)
gobley 0.3.7 OK checksum mismatch at uniffiCheckApiChecksums (glsdk.android.kt:1182), the same frames as the production crash
pinned gobley (this branch) OK OK (2/2)

In the full app (Blockstream Green on the same emulator, AOT-compiled with speed), built against these glsdk-android and LWK bindings, the wallet logs in and the app shows no "Lightning unavailable" alert, which it raises when glsdk fails to initialize. The stock build crashes at login.

…t ARM

gobley 0.3.7 declares u8/u16 FFI returns as Byte/Short with JNA direct
mapping. Rust zero-extends them and ART's compiled JNI stubs on 32-bit
ARM don't re-extend small return values, so once an app is AOT-compiled
the checksum check fails with "UniFFI API checksum mismatch" on
armeabi-v7a devices (gobley/gobley#252).

Install gobley-uniffi-bindgen from a pinned revision carrying the fix
proposed in gobley/gobley#297, into target/gobley so a crates.io copy
already installed isn't used instead.

This branch has not been deployed

No deployments
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.

gl-sdk Kotlin bindings: UniFFI checksum mismatch on 32-bit ARM Android (needs uniffi >= 0.32.1)

1 participant