Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Fix vphoned startup and VM launch on iOS 26

Lakrdb4c3057532e
diff --git a/VPhoneDaemon/VPhoneDaemon.xcodeproj/project.pbxproj b/VPhoneDaemon/VPhoneDaemon.xcodeproj/project.pbxproj
index 7f66b92f..97021953 100644
--- a/VPhoneDaemon/VPhoneDaemon.xcodeproj/project.pbxproj
+++ b/VPhoneDaemon/VPhoneDaemon.xcodeproj/project.pbxproj
@@ -201,6 +201,7 @@
C10000000000000000000071 /* XCRemoteSwiftPackageReference "icli" */,
C10000000000000000000072 /* XCRemoteSwiftPackageReference "swift-nio" */,
C10000000000000000000073 /* XCRemoteSwiftPackageReference "libarchive.xcframework" */,
+ C10000000000000000000074 /* XCRemoteSwiftPackageReference "swift-collections" */,
);
projectDirPath = "";
projectRoot = "";
@@ -429,6 +430,14 @@
version = 0.1.1;
};
};
+ C10000000000000000000074 /* XCRemoteSwiftPackageReference "swift-collections" */ = {
+ isa = XCRemoteSwiftPackageReference;
+ repositoryURL = "https://github.com/apple/swift-collections.git";
+ requirement = {
+ kind = exactVersion;
+ version = 1.6.0;
+ };
+ };
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
diff --git a/VPhoneDaemon/VPhoneDaemon.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/VPhoneDaemon/VPhoneDaemon.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
index fb7222b2..6f89829c 100644
--- a/VPhoneDaemon/VPhoneDaemon.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
+++ b/VPhoneDaemon/VPhoneDaemon.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -42,8 +42,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
- "revision" : "a66de878e87ef5a3d5d390e0f6d9002aa5541a43",
- "version" : "1.7.0"
+ "revision" : "a0cb0954ecb21e4e31b0070e6ed5674e8556685a",
+ "version" : "1.6.0"
}
},
{
diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/VirtualMachine/VPhoneVirtualMachineLaunchCommand.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/VirtualMachine/VPhoneVirtualMachineLaunchCommand.swift
index 044705fe..6250330f 100644
--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/VirtualMachine/VPhoneVirtualMachineLaunchCommand.swift
+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/VirtualMachine/VPhoneVirtualMachineLaunchCommand.swift
@@ -59,12 +59,13 @@ struct VPhoneVirtualMachineLaunchCommand: ParsableCommand {
_ = try layout.stageVphoned(into: bundle)
}
- var boot = VPhoneBootCommand()
- boot.config = bundle.configURL
- boot.dfu = dfu
- boot.headless = headless
- boot.apiListen = apiListen
- boot.kernelDebugPort = kernelDebugPort
+ let boot = VPhoneBootCommand(
+ config: bundle.configURL,
+ dfu: dfu,
+ headless: headless,
+ apiListen: apiListen,
+ kernelDebugPort: kernelDebugPort,
+ )
let args = boot.bootArguments
if v.tracesInternals {
diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh
index 9482135d..e77b87a5 100755
--- a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh
+++ b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh
@@ -47,6 +47,13 @@ daemon_products="$root/.build/XcodeDaemon/Build/Products/$configuration-iphoneos
amfi_products="$root/.build/XcodeAMFIAllow/Build/Products/$configuration"
guest_products="$root/.build/guest-components/stage"
+# The iOS 26 Swift runtime lacks this symbol. Swift Collections 1.7.0 emits
+# it with Xcode 27 even when vphoned targets iOS 15, causing a dyld crash loop.
+if /usr/bin/nm -u "$daemon_products/vphoned" | /usr/bin/grep -q '_swift_initBorrow'; then
+ print -u2 -- "vphoned requires _swift_initBorrow, which is unavailable on iOS 26"
+ exit 1
+fi
+
/bin/rm -rf "$macos" "$resources"
/bin/mkdir -p "$macos" "$resources/scripts/vphoned" "$resources/guest"
/bin/cp "$TARGET_BUILD_DIR/vphone-vm" "$macos/vphone-vm"
diff --git a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneBootCommand.swift b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneBootCommand.swift
index 9608cbf1..c0626f7e 100644
--- a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneBootCommand.swift
+++ b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneBootCommand.swift
@@ -74,6 +74,26 @@ public struct VPhoneBootCommand: ParsableCommand {
public init() {}
+ /// Construct a forwarding command without leaving any ArgumentParser
+ /// property wrapper in its undecoded definition state.
+ public init(
+ config: URL,
+ dfu: Bool = false,
+ headless: Bool = false,
+ apiListen: String? = nil,
+ kernelDebugPort: Int? = nil,
+ vphonedBin: String = ".vphoned.signed",
+ installIPA: URL? = nil,
+ ) {
+ self.config = config
+ self.dfu = dfu
+ self.headless = headless
+ self.apiListen = apiListen
+ self.kernelDebugPort = kernelDebugPort
+ self.vphonedBin = vphonedBin
+ self.installIPA = installIPA
+ }
+
/// DFU mode is always headless.
public var noGraphics: Bool {
dfu || headless