From 9f5d1b63cb9028227927d38cde6648532eda1ef3 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 18 Jul 2025 02:15:07 +0000 Subject: [PATCH] [WebAssembly] Create `clang/lib/wasip1` symlink only if it doesn't exist We are renaming `wasm32-unknown-wasi` to `wasm32-unknown-wasip1` for non-Embedded targets, so we will no longer have the `clang/lib/wasi`. --- .../SwiftSDKRecipes/WebAssemblyRecipe.swift | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Sources/SwiftSDKGenerator/SwiftSDKRecipes/WebAssemblyRecipe.swift b/Sources/SwiftSDKGenerator/SwiftSDKRecipes/WebAssemblyRecipe.swift index 1a7864a..0e3d956 100644 --- a/Sources/SwiftSDKGenerator/SwiftSDKRecipes/WebAssemblyRecipe.swift +++ b/Sources/SwiftSDKGenerator/SwiftSDKRecipes/WebAssemblyRecipe.swift @@ -195,15 +195,17 @@ package struct WebAssemblyRecipe: SwiftSDKRecipe { try await generator.createSymlink(at: autolinkExtractPath, pointingTo: "swift") } + // TODO: Remove this once we drop support for Swift 6.2 // Embedded Swift looks up clang compiler-rt in a different path. let embeddedCompilerRTPath = pathsConfiguration.toolchainDirPath.appending( "usr/lib/swift/clang/lib/wasip1" ) - - try await generator.createSymlink( - at: embeddedCompilerRTPath, - pointingTo: "../../../swift_static/clang/lib/wasi" - ) + if await !generator.doesFileExist(at: embeddedCompilerRTPath) { + try await generator.createSymlink( + at: embeddedCompilerRTPath, + pointingTo: "../../../swift_static/clang/lib/wasi" + ) + } // Copy the WASI sysroot into the SDK bundle. let sdkDirPath = pathsConfiguration.swiftSDKRootPath.appending("WASI.sdk")