mozilla / uniffi-rs

a multi-language bindings generator for rust
https://mozilla.github.io/uniffi-rs/
Mozilla Public License 2.0
2.89k stars 232 forks source link

Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR) with Kotlin Android #2328

Open Brooooooklyn opened 1 week ago

Brooooooklyn commented 1 week ago

I'm setting up the uniffi for my application: https://github.com/toeverything/AFFiNE/blob/11-14-feat_android_native_module/packages/frontend/mobile-native/src/lib.rs

The basic FFI implementation works fine here: https://github.com/toeverything/AFFiNE/blob/965132593b4fcba8e35776730029d1c600013d89/packages/frontend/apps/android/App/app/src/main/java/app/affine/pro/MainActivity.kt#L11-L20

CleanShot 2024-11-22 at 18 43 30@2x

However, the uniffi call causes a SIGSEGV

After some debugging, I found the RustBuffer() call here https://github.com/toeverything/AFFiNE/blob/11-14-feat_android_native_module/packages/frontend/apps/android/App/app/src/main/java/uniffi/affine_mobile_native/affine_mobile_native.kt#L246 is causing the SIGSEGV