chinedufn / swift-bridge

swift-bridge facilitates Rust and Swift interop.
https://chinedufn.github.io/swift-bridge
Apache License 2.0
838 stars 61 forks source link

Problem with x86_64-apple-ios-simulator #238

Open kanjanaMi opened 1 year ago

kanjanaMi commented 1 year ago

Hi, I try to create swift package following to this guideline.

cargo build --target aarch64-apple-ios

cargo build --target x86_64-apple-ios
cargo build --target aarch64-apple-ios-sim
mkdir -p ./target/universal-ios/debug

lipo \
    ./target/aarch64-apple-ios-sim/debug/libmy_rust_lib.a \
    ./target/x86_64-apple-ios/debug/libmy_rust_lib.a -create -output \
    ./target/universal-ios/debug/libmy_rust_lib.a

swift-bridge-cli create-package \
  --bridges-dir ./generated \
  --out-dir MySwiftPackage \
  --ios target/aarch64-apple-ios/debug/libmy_rust_lib.a \
  --simulator target/universal-ios/debug/libmy_rust_lib.a \
  --name MySwiftPackage

I imported SwiftPackage following to guideline but I found this error. Could not find module 'MySwiftPackage' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator

I also tried set flag Excluded architectures and build active architecture only but it didn't work.

Screen Shot 2566-08-07 at 15 24 04

I'm using M1 and my hacky workaround is checking the flag Open using Rosetta. Do you have any suggestions to fix this?

idxn commented 1 year ago

+1 I found the same problem. Do you also have any workarounds you may suggest?

chinedufn commented 1 year ago

I don't have an M1 so I'm not sure that I can try to reproduce this.

Do any of the answers in here work? https://stackoverflow.com/questions/56957632/could-not-find-module-for-target-x86-64-apple-ios-simulator