Skip to content

Commit d7264b7

Browse files
authored
Symlink libclang_rt.builtins.a for Embedded Swift for WASI (#213)
Embedded Swift looks up Clang's compiler-rt static library in a different path than non-embedded. These paths could be normalized in the future, but for now the easiest fix seems to be just to symlink the directory the static library is located in.
1 parent d45075e commit d7264b7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Sources/SwiftSDKGenerator/SwiftSDKRecipes/WebAssemblyRecipe.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ package struct WebAssemblyRecipe: SwiftSDKRecipe {
181181
)
182182
}
183183

184-
let autolinkExtractPath = generator.pathsConfiguration.toolchainBinDirPath.appending(
184+
let autolinkExtractPath = pathsConfiguration.toolchainBinDirPath.appending(
185185
"swift-autolink-extract"
186186
)
187187

@@ -195,6 +195,13 @@ package struct WebAssemblyRecipe: SwiftSDKRecipe {
195195
try await generator.createSymlink(at: autolinkExtractPath, pointingTo: "swift")
196196
}
197197

198+
// Embedded Swift looks up clang compiler-rt in a different path.
199+
let embeddedCompilerRTPath = pathsConfiguration.toolchainDirPath.appending(
200+
"usr/lib/swift/clang/lib/wasip1"
201+
)
202+
203+
try await generator.createSymlink(at: embeddedCompilerRTPath, pointingTo: "wasi")
204+
198205
// Copy the WASI sysroot into the SDK bundle.
199206
let sdkDirPath = pathsConfiguration.swiftSDKRootPath.appending("WASI.sdk")
200207
try await generator.rsyncContents(from: self.wasiSysroot, to: sdkDirPath)

0 commit comments

Comments
 (0)