Closed jkelleyrtp closed 3 months ago
Thanks for taking this on! This has been a long standing issue that we have been blocked internally on by simply not having access to Apple Silicon machines on the engineering team.
I think there might be still some more changes required to fully work on M1. Even using this branch I'm getting the following error during linking:
ld: warning: directory not found for option '-L/Users/user/Xcode projects/rust-test/target/aarch64-apple-ios-sim/debug'
ld: library not found for -lrust_test
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The reason seems to be that in the build for the library, the wrong architecture triple is used (aarch64-apple-ios instead of aarch64-apple-ios-sim):
[2022-04-28T16:16:12Z INFO bossy] running command "cargo build --package rust-test --manifest-path /Users/user/Xcode projects/rust-test/Cargo.toml --target aarch64-apple-ios --color auto" and waiting for exit
Hence there is no "target/aarch64-apple-ios-sim" directory getting generated (but only "target/aarch64-apple-ios"). To fix this "src/apple/target.rs" might need to be modified to add the target with the triple "aarch64-apple-ios-sim" as well.
@const-volatile
I've been manually building the sim target, so yeah I think there's a missing target. To work around it locally:
cargo build --target aarch64-apple-ios-sim
This adjusts some targets to get cargo-mobile working on macOS with Apple Silicon.
NOTE: Currently, the changes here only work for m1. I have not made any adjustments to adopt both platforms. I plan to get that working sometime in the future, so this PR is just mainly to provide others looking for M1 support a fork to install from.