From bdc3a801f2a6cbc73b0d42c69746085ef9064c9c Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Fri, 29 Aug 2025 16:07:19 -0400 Subject: [PATCH 1/2] Don't include librarian path to llvm-ar when using preinstalled Swift toolchain --- .../SwiftSDKGenerator/SwiftSDKRecipes/LinuxRecipe.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/SwiftSDKGenerator/SwiftSDKRecipes/LinuxRecipe.swift b/Sources/SwiftSDKGenerator/SwiftSDKRecipes/LinuxRecipe.swift index af3ecc4..50ff013 100644 --- a/Sources/SwiftSDKGenerator/SwiftSDKRecipes/LinuxRecipe.swift +++ b/Sources/SwiftSDKGenerator/SwiftSDKRecipes/LinuxRecipe.swift @@ -143,7 +143,12 @@ package struct LinuxRecipe: SwiftSDKRecipe { toolset.swiftCompiler = Toolset.ToolProperties(extraCLIOptions: swiftCompilerOptions) toolset.cxxCompiler = Toolset.ToolProperties(extraCLIOptions: ["-lstdc++"]) - toolset.librarian = Toolset.ToolProperties(path: "llvm-ar") + + // Don't include path to librarian if we're using the preinstalled toolchain + // Workaround for https://github.com/swiftlang/swift-package-manager/issues/9035 + if self.hostSwiftSource != .preinstalled { + toolset.librarian = Toolset.ToolProperties(path: "llvm-ar") + } } package func applyPlatformOptions( From ef2441e67bd9e88194971d186703d41c5c30c369 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Sun, 31 Aug 2025 17:51:59 +0000 Subject: [PATCH 2/2] Modify preinstalled SDK Linux test to show that no librarian path is included --- .../SwiftSDKRecipes/LinuxRecipeTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/SwiftSDKGeneratorTests/SwiftSDKRecipes/LinuxRecipeTests.swift b/Tests/SwiftSDKGeneratorTests/SwiftSDKRecipes/LinuxRecipeTests.swift index b57807e..0c58224 100644 --- a/Tests/SwiftSDKGeneratorTests/SwiftSDKRecipes/LinuxRecipeTests.swift +++ b/Tests/SwiftSDKGeneratorTests/SwiftSDKRecipes/LinuxRecipeTests.swift @@ -116,7 +116,7 @@ final class LinuxRecipeTests: XCTestCase { ] ) XCTAssertEqual(toolset.cxxCompiler?.extraCLIOptions, ["-lstdc++"]) - XCTAssertEqual(toolset.librarian?.path, "llvm-ar") + XCTAssert(toolset.librarian == nil) XCTAssert(toolset.linker == nil) }