Include toolchain search paths in the build description signature - #1800
Open
cybercussion wants to merge 1 commit into
Open
cybercussion wants to merge 1 commit into
cybercussion wants to merge 1 commit into
Conversation
The Metal Toolchain component is a cryptex mounted under a new random directory name each time (e.g. after a reboot). SwiftPM passes that mount point to the build service as EXTERNAL_TOOLCHAINS_DIR, and tool paths resolved from it (TOOLCHAIN_DIR, the `metal` compiler) are baked into the build description. Nothing in the build description signature captured where toolchains were found, so after a remount the cached description was reused and the build failed with "unable to spawn process '<old mount>/…/metal' (No such file or directory)". Add Core.toolchainSearchPathsSignature (the resolved toolchain search paths, including EXTERNAL_TOOLCHAINS_DIR entries) and include it in BuildDescriptionSignatureComponents, mirroring sdkInputsSignature (swiftlang#1792), so a moved toolchain forces a fresh build description. Fixes swiftlang#1798 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
cybercussion
requested review from
cmcgee1024,
daveinglis,
jakepetroules,
mhrawdon,
owenv,
rconnell9 and
rjmansfield
as code owners
September 28, 2026 15:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1798.
Problem
The Metal Toolchain component is a cryptex mounted at
/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v<version>.<random>, and the random suffix changes on every mount (e.g. after a reboot). SwiftPM passes that mount point to the build service asEXTERNAL_TOOLCHAINS_DIR(SwiftBuildSystem.swift), and tool paths resolved from it (TOOLCHAIN_DIR, themetalcompiler) are baked into the build description.BuildDescriptionSignatureComponentsrecords nothing about where toolchains were found. After a remount the cached description is reused, and the build fails:(The toolchain was now mounted at
…gTiXky, and it works.)Fix
This follows the pattern of #1792 (
sdkInputsSignature):Core.toolchainSearchPathsSignature: the resolved toolchain search paths, includingEXTERNAL_TOOLCHAINS_DIRentries.BuildDescriptionSignatureComponents, so a moved toolchain forces a fresh build description.Unchanged search paths give an identical signature, so a normal incremental build still reuses its build description.
Testing
CoreTests.toolchainSearchPathsSignatureTracksExternalToolchainMount: the same Metal toolchain under two different mount suffixes gives different signatures, and the same mount gives equal ones.swift test --filter "SWBTaskExecutionTests|SWBCoreTests": 598 tests pass. The 2 known issues were already marked as known (MultiPlatformDependencyResolverTests).Shaders.metal), on Xcode 27.0 (27A266a), macOS 26.6.2, MetalToolchain v27.1.266.1,swift buildfailing the morning after a reboot.🤖 Generated with Claude Code