Skip to content

Commit ab16fe7

Browse files
Remove llvm-ar librarian path from Swift SDK built with no host toolchain included (#240)
Fixes #233
1 parent e29733e commit ab16fe7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Sources/SwiftSDKGenerator/SwiftSDKRecipes/LinuxRecipe.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,12 @@ package struct LinuxRecipe: SwiftSDKRecipe {
143143
toolset.swiftCompiler = Toolset.ToolProperties(extraCLIOptions: swiftCompilerOptions)
144144

145145
toolset.cxxCompiler = Toolset.ToolProperties(extraCLIOptions: ["-lstdc++"])
146-
toolset.librarian = Toolset.ToolProperties(path: "llvm-ar")
146+
147+
// Don't include path to librarian if we're using the preinstalled toolchain
148+
// Workaround for https://github.com/swiftlang/swift-package-manager/issues/9035
149+
if self.hostSwiftSource != .preinstalled {
150+
toolset.librarian = Toolset.ToolProperties(path: "llvm-ar")
151+
}
147152
}
148153

149154
package func applyPlatformOptions(

Tests/SwiftSDKGeneratorTests/SwiftSDKRecipes/LinuxRecipeTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ final class LinuxRecipeTests: XCTestCase {
116116
]
117117
)
118118
XCTAssertEqual(toolset.cxxCompiler?.extraCLIOptions, ["-lstdc++"])
119-
XCTAssertEqual(toolset.librarian?.path, "llvm-ar")
119+
XCTAssert(toolset.librarian == nil)
120120
XCTAssert(toolset.linker == nil)
121121
}
122122

0 commit comments

Comments
 (0)