Skip to content

Commit eed7c21

Browse files
Remove 32-bit libraries from RHEL sysroots built from containers
- These are not needed, and the amazonlinux2 ones have broken symlinks that cause failures to generate the Swift SDK.
1 parent df46d2f commit eed7c21

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Copy.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ extension SwiftSDKGenerator {
9191
}
9292
try await generator.createSymlink(at: sdkDirPath.appending("lib"), pointingTo: "usr/lib")
9393

94+
// Look for 32-bit libraries to remove from RHEL-based distros
95+
// These are not needed, and the amazonlinux2 x86_64 symlinks are messed up
96+
if case .rhel = targetDistribution {
97+
for gccVersion in 7...13 {
98+
let removePath = "gcc/x86_64-redhat-linux/\(gccVersion)/32"
99+
if await doesFileExist(at: sdkUsrLibPath.appending(removePath)) {
100+
logger.warning("Removing 32-bit libraries from RHEL imported sysroot", metadata: ["removePath": .stringConvertible(removePath)])
101+
try await removeRecursively(at: sdkUsrLibPath.appending(removePath))
102+
}
103+
}
104+
}
105+
94106
// Copy the ELF interpreter
95107
try await generator.copyFromDockerContainer(
96108
id: containerID,

0 commit comments

Comments
 (0)