Closed jhugman closed 2 weeks ago
That sounds a little like a mismatch between the bytes written by that item vs the bytes we think we should read. Can you share the definition of UNIFFI_META_MATRIX_SDK_FFI_INTERFACE_ENCRYPTION
as emitted by the macros?
Using cargo expand
, I'm getting:
const UNIFFI_META_CONST_MATRIX_SDK_FFI_INTERFACE_ENCRYPTION: ::uniffi::MetadataBuffer = ::uniffi::MetadataBuffer::from_code(
::uniffi::metadata::codes::INTERFACE,
)
.concat_str("matrix_sdk_ffi")
.concat_str("Encryption")
.concat_long_str("");
#[no_mangle]
#[doc(hidden)]
pub static UNIFFI_META_MATRIX_SDK_FFI_INTERFACE_ENCRYPTION: [u8; UNIFFI_META_CONST_MATRIX_SDK_FFI_INTERFACE_ENCRYPTION
.size] = UNIFFI_META_CONST_MATRIX_SDK_FFI_INTERFACE_ENCRYPTION.into_array();
Yeah, the reading/writing of the metadata works just fine in debug, and with other architectures.
I would guess (and I am guessing here), is that there is some subtlety in the extract_elf
method that works in debug
OR lib.so
, but not in release
AND lib.a
.
@bendk pointed out a fix for a similar looking problem in MachO builds.
I'm trying to use
library_mode
togenerate_bindings
from a reasonably large crate, the matrix-sdk-ffi bindings.Also relevant: I've bumped
uniffi
to version0.28.2
.Using
cargo ndk
, I'm building the staticlib version foraarc64-linux-android
, in release mode only.Then using
print-repr
to look at the metadata.Output is:
A lightly instrumented uniffi which prints in
extract_item
that a symbol has been recognized, but is an unrecognized metadata code:Unfortunately, I don't understand ELF, ndk or the process of it being written to move the investigation further.
Investigation to get to here: https://github.com/jhugman/uniffi-bindgen-react-native/issues/122