Change:
Currently in our application we cannot run the iOS simulator on M1 machines because it is expecting architecture. Forcing using the target can build the project and ship the application but this targets the iOS Device SDK, and will not build in the simulator for testing with this error: should provide an target that uses the iOS Simulator SDK.
Is relevant at all? Can the same path be followed?
Awesome find I'll try doing this! If successful I'll open a similar PR :)
Ran into this now too. Happy to help here as well. Did you already get started?
I did but having trouble I've pushed my changes here: More than happy to work with you on this Jan!
I'll try to get a dev environment set up and then I'll take a look.
I built the toolchain successfully, but when I try to compile my project (with either or ) I'm getting: I think I've missed a setting in the build config I'm using, because the normal nightly compiles fine :( : Edit looks like I will try off :
Yeah, that looks like upstream breakage in because of recent changes. I can try taking your code tomorrow and throw this against my project to see if that fixes my simulator issues.
Yeah I the patch mentioned in that issue and am getting further but: which Xcode still seems to be getting x8664 somewhere: I tried replacing all the with and got closer: but got:
I believe my current version is working but there's something off in my Xcode project that I need to figure out:
Ah, you're building a binary? Yeah, that seems to sort-of work now? I managed to build your branch, my static library is still unchanged. I think we actually need LLVM 12 first to fully enable this ().
It was just a test to see if the simulator is working at all XD. Yeah my file is still saying it's :

Discussion:
("x86_64", "tvos") => "appletvsimulator", ("arm", "ios") => "iphoneos", ("aarch64", "ios") if llvm_target.contains("macabi") => "macosx", <ins> ("aarch64", "ios") if llvm_target.contains("sim") => "iphonesimulator", </ins> ("aarch64", "ios") => "iphoneos", ("x86", "ios") => "iphonesimulator", ("x86_64", "ios") if llvm_target.contains("macabi") => "macosx",

<ins> use super::apple_sdk_base::{opts, Arch}; use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { let base = opts("ios", Arch::Arm64_sim); // Clang automatically chooses a more specific target based on // IPHONEOS_DEPLOYMENT_TARGET. // This is required for the simulator target to pick the right // MACH-O commands, so we do too. let arch = "arm64"; let llvm_target = super::apple_base::ios_sim_llvm_target(arch); Target { llvm_target: llvm_target, pointer_width: 64, data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(), arch: "aarch64".to_string(), options: TargetOptions { features: "+neon,+fp-armv8,+apple-a7".to_string(), eliminate_frame_pointer: false, max_atomic_width: Some(128), unsupported_abis: super::arm_base::unsupported_abis(), forces_embed_bitcode: true, // Taken from a clang build on Xcode 11.4.1. // These arguments are not actually invoked - they just have // to look right to pass App Store validation. bitcode_llvm_cmdline: "-triple0 arm64-apple-ios14.0-simulator0 -emit-obj0 -disable-llvm-passes0 -target-abi0 darwinpcs0 -Os0" .to_string(), ..base }, } } </ins>

} } <del> fn macos_deployment_target() -> (u32, u32) { let deployment_target = env::var("MACOSX_DEPLOYMENT_TARGET").ok(); let version = deployment_target </del> <ins> fn deployment_target(var_name: &str) -> Option<(u32, u32)> { let deployment_target = env::var(var_name).ok(); deployment_target </ins> .as_ref() .and_then(|s| s.split_once('.')) <del> .and_then(|(a, b)| a.parse::<u32>().and_then(|a| b.parse::<u32>().map(|b| (a, b))).ok()); </del> <ins> .and_then(|(a, b)| a.parse::<u32>().and_then(|a| b.parse::<u32>().map(|b| (a, b))).ok()) } </ins> <del> version.unwrap_or((10, 7)) </del> <ins> fn macos_deployment_target() -> (u32, u32) { deployment_target("MACOSX_DEPLOYMENT_TARGET").unwrap_or((10, 7)) </ins> } pub fn macos_llvm_target(arch: &str) -> String {

env_remove.push("IPHONEOS_DEPLOYMENT_TARGET".to_string()); env_remove } <ins> fn ios_deployment_target() -> (u32, u32) { deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((7, 0)) } pub fn ios_sim_llvm_target(arch: &str) -> String { let (major, minor) = ios_deployment_target(); format!("{}-apple-ios{}.{}.0-simulator", arch, major, minor) } </ins>

X86_64, X86_64_macabi, Arm64_macabi, <ins> Arm64_sim, </ins> } fn target_cpu(arch: Arch) -> String {

X86_64 => "core2", X86_64_macabi => "core2", Arm64_macabi => "apple-a12", <ins> Arm64_sim => "apple-a12", </ins> } .to_string() } fn link_env_remove(arch: Arch) -> Vec<String> { match arch { <del> Armv7 | Armv7s | Arm64 | I386 | X86_64 => vec!["MACOSX_DEPLOYMENT_TARGET".to_string()], </del> <ins> Armv7 | Armv7s | Arm64 | I386 | X86_64 | Arm64_sim => { vec!["MACOSX_DEPLOYMENT_TARGET".to_string()] } </ins> X86_64_macabi | Arm64_macabi => vec!["IPHONEOS_DEPLOYMENT_TARGET".to_string()], } }

("armv7s-apple-ios", armv7s_apple_ios), ("x86_64-apple-ios-macabi", x86_64_apple_ios_macabi), ("aarch64-apple-ios-macabi", aarch64_apple_ios_macabi), <ins> ("aarch64-apple-ios-sim", aarch64_apple_ios_sim), </ins> ("aarch64-apple-tvos", aarch64_apple_tvos), ("x86_64-apple-tvos", x86_64_apple_tvos),

target | std | host | notes -------|-----|------|------- `aarch64-apple-ios-macabi` | ? |  | Apple Catalyst on ARM64 <ins> `aarch64-apple-ios-sim` | ? |  | Apple iOS Simulator on ARM64 </ins> `aarch64-apple-tvos` | * |  | ARM64 tvOS `aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD `aarch64-unknown-hermit` | ? |  |