Skip to content

Commit 796fc38

Browse files
Add symlinks of /lib and /lib64 to /usr when building from packages
- This fixes the issue with the Ubuntu Noble packages not containing /lib64 as other Ubuntu versions do.
1 parent 705009c commit 796fc38

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Download.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,17 @@ extension SwiftSDKGenerator {
147147
try await fs.unpack(file: tmpDir.appending(fileName), into: sdkDirPath)
148148
}
149149
}
150+
151+
// Make sure we have /lib and /lib64, and if not symlink from /usr
152+
// This makes building from packages more consistent with copying from the Docker container
153+
let libDirectories = ["lib", "lib64"]
154+
for dir in libDirectories {
155+
let sdkLibPath = sdkDirPath.appending(dir)
156+
let sdkUsrLibPath = sdkDirPath.appending("usr/\(dir)")
157+
if !doesFileExist(at: sdkLibPath) && doesFileExist(at: sdkUsrLibPath) {
158+
try createSymlink(at: sdkLibPath, pointingTo: FilePath("./usr/\(dir)"))
159+
}
160+
}
150161
}
151162

152163
func downloadFiles(

0 commit comments

Comments
 (0)