Skip to content

Commit 0802529

Browse files
authored
fix(cli): iOS dev broken on Xcode 16.3, closes #13128 (#13210)
* fix(cli): iOS dev broken on Xcode 16.3, closes #13128 Looks like we cannot use the arm64-sim custom architecture on Xcode 16.3, as it incorrectly appends the -sim suffix on some clang build scripts which ends up with an invalid target triple. Currently we do not have automation to update Xcode/Android projects, so a manual intervention is required by our users, either recreating the project or modifying it manually (the arm64-sim arch must be removed and all its references). ref tauri-apps/cargo-mobile2#445 * fix dev on macOS with intel chip
1 parent 66e6325 commit 0802529

File tree

9 files changed

+189
-212
lines changed

9 files changed

+189
-212
lines changed

.changes/fix-ios-xcode-16.3.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-cli": patch:bug
3+
"@tauri-apps/cli": patch:bug
4+
---
5+
6+
Fixes iOS dev not working on Xcode 16.3 simulators. To apply the fix, either regenerate the Xcode project with `rm -r src-tauri/gen/apple && tauri ios init` or remove the `arm64-sim` architecture from the Xcode project.

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/tauri-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ name = "cargo-tauri"
3636
path = "src/main.rs"
3737

3838
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"windows\", target_os = \"macos\"))".dependencies]
39-
cargo-mobile2 = { version = "0.17", default-features = false }
39+
cargo-mobile2 = { version = "0.18", default-features = false }
4040

4141
[dependencies]
4242
jsonrpsee = { version = "0.24", features = ["server"] }

crates/tauri-cli/src/mobile/ios/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub fn gen(
7373
let macos_pods = metadata.macos().pods().unwrap_or_default();
7474

7575
#[cfg(target_arch = "aarch64")]
76-
let default_archs = ["arm64", "arm64-sim"];
76+
let default_archs = ["arm64"];
7777
#[cfg(not(target_arch = "aarch64"))]
7878
let default_archs = ["arm64", "x86_64"];
7979

crates/tauri-cli/src/mobile/ios/xcode_script.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,24 @@ pub fn command(options: Options) -> Result<()> {
175175

176176
let isysroot = format!("-isysroot {}", options.sdk_root.display());
177177

178-
for arch in options.arches {
178+
let simulator = options.arches.contains(&"Simulator".to_string());
179+
let arches = if simulator {
180+
// when compiling for the simulator, we don't need to build other targets
181+
vec![if cfg!(target_arch = "aarch64") {
182+
"arm64"
183+
} else {
184+
"x86_64"
185+
}
186+
.to_string()]
187+
} else {
188+
options.arches
189+
};
190+
for arch in arches {
179191
// Set target-specific flags
180192
let (env_triple, rust_triple) = match arch.as_str() {
181-
"arm64" => ("aarch64_apple_ios", "aarch64-apple-ios"),
182-
"arm64-sim" => ("aarch64_apple_ios_sim", "aarch64-apple-ios-sim"),
193+
"arm64" if !simulator => ("aarch64_apple_ios", "aarch64-apple-ios"),
194+
"arm64" if simulator => ("aarch64_apple_ios_sim", "aarch64-apple-ios-sim"),
183195
"x86_64" => ("x86_64_apple_ios", "x86_64-apple-ios"),
184-
"Simulator" => {
185-
// when using Xcode, the arches for a simulator build will be ['Simulator', 'arm64-sim'] instead of ['arm64-sim']
186-
// so we ignore that on our end
187-
continue;
188-
}
189196
_ => {
190197
return Err(anyhow::anyhow!(
191198
"Arch specified by Xcode was invalid. {} isn't a known arch",
@@ -210,7 +217,12 @@ pub fn command(options: Options) -> Result<()> {
210217
let target = if macos {
211218
&macos_target
212219
} else {
213-
Target::for_arch(&arch).ok_or_else(|| {
220+
Target::for_arch(if arch == "arm64" && simulator {
221+
"arm64-sim"
222+
} else {
223+
&arch
224+
})
225+
.ok_or_else(|| {
214226
anyhow::anyhow!(
215227
"Arch specified by Xcode was invalid. {} isn't a known arch",
216228
arch

crates/tauri-cli/templates/mobile/ios/project.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@ targets:
8080
VALID_ARCHS: {{~#each ios-valid-archs}} {{this}} {{/each}}
8181
LIBRARY_SEARCH_PATHS[arch=x86_64]: $(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
8282
LIBRARY_SEARCH_PATHS[arch=arm64]: $(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
83-
LIBRARY_SEARCH_PATHS[arch=arm64-sim]: $(inherited) $(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
8483
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: true
85-
EXCLUDED_ARCHS[sdk=iphonesimulator*]: arm64
86-
EXCLUDED_ARCHS[sdk=iphoneos*]: arm64-sim x86_64
84+
EXCLUDED_ARCHS[sdk=iphoneos*]: x86_64
8785
groups: [app]
8886
dependencies:
8987
- framework: {{ lib-output-file-name }}
@@ -127,7 +125,6 @@ targets:
127125
outputFiles:
128126
- $(SRCROOT)/Externals/x86_64/${CONFIGURATION}/{{ lib-output-file-name }}
129127
- $(SRCROOT)/Externals/arm64/${CONFIGURATION}/{{ lib-output-file-name }}
130-
- $(SRCROOT)/Externals/arm64-sim/${CONFIGURATION}/{{ lib-output-file-name }}
131128
{{~#if ios-post-compile-scripts}}
132129
postCompileScripts:
133130
{{~#each ios-post-compile-scripts}}{{#if this.path}}

crates/tauri-cli/tests/fixtures/pbxproj/project.pbxproj

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@
238238
outputPaths = (
239239
"$(SRCROOT)/Externals/x86_64/${CONFIGURATION}/libapi_lib.a",
240240
"$(SRCROOT)/Externals/arm64/${CONFIGURATION}/libapi_lib.a",
241-
"$(SRCROOT)/Externals/arm64-sim/${CONFIGURATION}/libapi_lib.a",
242241
);
243242
runOnlyForDeploymentPostprocessing = 0;
244243
shellPath = /bin/sh;
@@ -383,15 +382,13 @@
383382
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
384383
ARCHS = (
385384
arm64,
386-
"arm64-sim",
387385
);
388386
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
389387
CODE_SIGN_ENTITLEMENTS = api_iOS/api_iOS.entitlements;
390388
CODE_SIGN_IDENTITY = "iPhone Developer";
391389
DEVELOPMENT_TEAM = Q93MBH6S2F;
392390
ENABLE_BITCODE = NO;
393-
"EXCLUDED_ARCHS[sdk=iphoneos*]" = "arm64-sim x86_64";
394-
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
391+
"EXCLUDED_ARCHS[sdk=iphoneos*]" = "x86_64";
395392
FRAMEWORK_SEARCH_PATHS = (
396393
"$(inherited)",
397394
"\".\"",
@@ -401,14 +398,13 @@
401398
"$(inherited)",
402399
"@executable_path/Frameworks",
403400
);
404-
"LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
405401
"LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
406402
"LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
407403
PRODUCT_BUNDLE_IDENTIFIER = com.tauri.api;
408404
PRODUCT_NAME = "Tauri API";
409405
SDKROOT = iphoneos;
410406
TARGETED_DEVICE_FAMILY = "1,2";
411-
VALID_ARCHS = "arm64 arm64-sim";
407+
VALID_ARCHS = "arm64";
412408
};
413409
name = debug;
414410
};
@@ -418,15 +414,13 @@
418414
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
419415
ARCHS = (
420416
arm64,
421-
"arm64-sim",
422417
);
423418
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
424419
CODE_SIGN_ENTITLEMENTS = api_iOS/api_iOS.entitlements;
425420
CODE_SIGN_IDENTITY = "iPhone Developer";
426421
DEVELOPMENT_TEAM = Q93MBH6S2F;
427422
ENABLE_BITCODE = NO;
428-
"EXCLUDED_ARCHS[sdk=iphoneos*]" = "arm64-sim x86_64";
429-
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
423+
"EXCLUDED_ARCHS[sdk=iphoneos*]" = "x86_64";
430424
FRAMEWORK_SEARCH_PATHS = (
431425
"$(inherited)",
432426
"\".\"",
@@ -436,14 +430,13 @@
436430
"$(inherited)",
437431
"@executable_path/Frameworks",
438432
);
439-
"LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
440433
"LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
441434
"LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
442435
PRODUCT_BUNDLE_IDENTIFIER = com.tauri.api;
443436
PRODUCT_NAME = "Tauri API";
444437
SDKROOT = iphoneos;
445438
TARGETED_DEVICE_FAMILY = "1,2";
446-
VALID_ARCHS = "arm64 arm64-sim";
439+
VALID_ARCHS = "arm64";
447440
};
448441
name = release;
449442
};

crates/tauri-cli/tests/fixtures/pbxproj/snapshots/tauri_cli__helpers__pbxproj__tests__project-modified.pbxproj.snap

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: src/helpers/pbxproj.rs
2+
source: crates/tauri-cli/src/helpers/pbxproj.rs
33
expression: pbxproj.serialize()
44
---
55
// !$*UTF8*$!
@@ -242,7 +242,6 @@ expression: pbxproj.serialize()
242242
outputPaths = (
243243
"$(SRCROOT)/Externals/x86_64/${CONFIGURATION}/libapi_lib.a",
244244
"$(SRCROOT)/Externals/arm64/${CONFIGURATION}/libapi_lib.a",
245-
"$(SRCROOT)/Externals/arm64-sim/${CONFIGURATION}/libapi_lib.a",
246245
);
247246
runOnlyForDeploymentPostprocessing = 0;
248247
shellPath = /bin/sh;
@@ -387,15 +386,13 @@ expression: pbxproj.serialize()
387386
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
388387
ARCHS = (
389388
arm64,
390-
"arm64-sim",
391389
);
392390
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
393391
CODE_SIGN_ENTITLEMENTS = api_iOS/api_iOS.entitlements;
394392
CODE_SIGN_IDENTITY = "iPhone Developer";
395393
DEVELOPMENT_TEAM = Q93MBH6S2F;
396394
ENABLE_BITCODE = NO;
397-
"EXCLUDED_ARCHS[sdk=iphoneos*]" = "arm64-sim x86_64";
398-
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
395+
"EXCLUDED_ARCHS[sdk=iphoneos*]" = "x86_64";
399396
FRAMEWORK_SEARCH_PATHS = (
400397
"$(inherited)",
401398
"\".\"",
@@ -405,14 +402,13 @@ expression: pbxproj.serialize()
405402
"$(inherited)",
406403
"@executable_path/Frameworks",
407404
);
408-
"LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
409405
"LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
410406
"LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
411407
PRODUCT_BUNDLE_IDENTIFIER = com.tauri.api;
412408
PRODUCT_NAME = "Tauri API";
413409
SDKROOT = iphoneos;
414410
TARGETED_DEVICE_FAMILY = "1,2";
415-
VALID_ARCHS = "arm64 arm64-sim";
411+
VALID_ARCHS = "arm64";
416412
};
417413
name = debug;
418414
};
@@ -422,15 +418,13 @@ expression: pbxproj.serialize()
422418
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
423419
ARCHS = (
424420
arm64,
425-
"arm64-sim",
426421
);
427422
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
428423
CODE_SIGN_ENTITLEMENTS = api_iOS/api_iOS.entitlements;
429424
CODE_SIGN_IDENTITY = "iPhone Developer";
430425
DEVELOPMENT_TEAM = Q93MBH6S2F;
431426
ENABLE_BITCODE = NO;
432-
"EXCLUDED_ARCHS[sdk=iphoneos*]" = "arm64-sim x86_64";
433-
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
427+
"EXCLUDED_ARCHS[sdk=iphoneos*]" = "x86_64";
434428
FRAMEWORK_SEARCH_PATHS = (
435429
"$(inherited)",
436430
"\".\"",
@@ -440,14 +434,13 @@ expression: pbxproj.serialize()
440434
"$(inherited)",
441435
"@executable_path/Frameworks",
442436
);
443-
"LIBRARY_SEARCH_PATHS[arch=arm64-sim]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
444437
"LIBRARY_SEARCH_PATHS[arch=arm64]" = "$(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
445438
"LIBRARY_SEARCH_PATHS[arch=x86_64]" = "$(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)";
446439
PRODUCT_BUNDLE_IDENTIFIER = com.tauri.api;
447440
PRODUCT_NAME = "Tauri Test";
448441
SDKROOT = iphoneos;
449442
TARGETED_DEVICE_FAMILY = "1,2";
450-
VALID_ARCHS = "arm64 arm64-sim";
443+
VALID_ARCHS = "arm64";
451444
UNKNOWN = 9283j49238h;
452445
};
453446
name = release;

0 commit comments

Comments
 (0)