Skip to content

build: per-arch SwiftPM scratch paths (Swift 6.4's triple-independent layout breaks universal builds) - #6

Open
djbclark wants to merge 1 commit into
stanczykwyatt:mainfrom
frdminc:fix/swift64-per-arch-scratch
Open

djbclark wants to merge 1 commit into
stanczykwyatt:mainfrom
frdminc:fix/swift64-per-arch-scratch

Conversation

@djbclark

Copy link
Copy Markdown

On Swift 6.4 (swiftlang-6.4.0.34.1, macOS 27.x CLT), SwiftPM's default scratch layout is triple-independent: --show-bin-path returns .build/out/Products/Release regardless of --triple, and .build/<triple>/ is never created. With a shared scratch, both arch builds in scripts/build-app.sh therefore report the same bin path, the x86_64 build overwrites the arm64 binary, and the script fails at:

lipo: same architectures (x86_64) found in '.build/out/Products/Release/RightFolder' and '.build/out/Products/Release/RightFolder'

Fix: give each architecture its own --scratch-path. The bin path is still discovered via --show-bin-path, so the script keeps working on older triple-keyed layouts too.

Verified on macOS 27.2 / Apple Swift 6.4: scripts/build-app.sh produces build/Right Folder.app with a fat binary (x86_64 + arm64), ad-hoc signed, codesign --verify --strict clean.

Adversary security/correctness review verdict: "no defects requiring change." Flag name --scratch-path is valid since the --build-path deprecation (Swift 5.1/5.2 era) and strictly more portable than the since-removed alias; correct on both old ($scratch/$triple/Release) and new layouts; quoting, set -euo pipefail and path-collision checks clean.

Swift 6.4's default scratch layout is triple-independent (out/Products/Release),
so with a shared scratch both --triple builds reported the same --show-bin-path
and the x86_64 build overwrote the arm64 binary before lipo, failing with
"lipo: same architectures (x86_64)". A per-arch --scratch-path also works on
older triple-keyed layouts.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant