jhugman / uniffi-bindgen-react-native

A uniffi bindings generator for calling Rust from react-native
Other
0 stars 0 forks source link

Building two simulator frameworks requires using lipo on the artifacts #77

Open zzorba opened 3 weeks ago

zzorba commented 3 weeks ago

If you specify both an x86 and an arm64 simulator in your .yaml file:

ios:
  directory: ios
  targets:
    - aarch64-apple-ios
    - aarch64-apple-ios-sim
    - x86_64-apple-ios

Building on iOS will attempt to create an xcframework, but it will fail because it contains TWO simulator targets. Based on the code in the matrix-rust-sdk, https://github.com/matrix-org/matrix-rust-sdk/blob/main/xtask/src/swift.rs, the correct thing to do in this situation is to use lipo on the two simulator lib files to produce a single fat lib. This can then be passed successfully to the xcframework command.

I don't know how urgent this is to FIX FIX, given that x86 is on the way out. But having uniffi bindgen detect both x86 and arm64 simulators and call it out as unsupported seems better.

Adding an option to skip the .xcframework creation would also be a helpful escape hatch.

jhugman commented 2 weeks ago

Adding an option to skip the .xcframework creation would also be a helpful escape hatch.

For later readers, the --no-xcodebuild / --no-xcframework escape hatch was landed in https://github.com/jhugman/uniffi-bindgen-react-native/pull/71/commits/cade14de0b1ded65eb3a3f5e1ab96cb19aa12e91.

This escape hatch on its own does not fix this issue.