1Swiftpm looks for the Swift stdlib relative to the swift compiler, but that's a
2wrapper in our case. It wants to add the stdlib to the rpath, which is
3necessary for back-deployment of some features.
4
5--- a/Sources/PackageModel/Toolchain.swift
6+++ b/Sources/PackageModel/Toolchain.swift
7@@ -53,12 +53,18 @@ extension Toolchain {
8
9 public var macosSwiftStdlib: AbsolutePath {
10 get throws {
11+ if swiftCompilerPath.pathString.starts(with: "@storeDir@") {
12+ return AbsolutePath("@swiftLib@/lib/swift/macosx")
13+ }
14 return try AbsolutePath(validating: "../../lib/swift/macosx", relativeTo: resolveSymlinks(swiftCompilerPath))
15 }
16 }
17
18 public var toolchainLibDir: AbsolutePath {
19 get throws {
20+ if swiftCompilerPath.pathString.starts(with: "@storeDir@") {
21+ return AbsolutePath("@swiftLib@/lib")
22+ }
23 // FIXME: Not sure if it's better to base this off of Swift compiler or our own binary.
24 return try AbsolutePath(validating: "../../lib", relativeTo: resolveSymlinks(swiftCompilerPath))
25 }