From 3bd836ba4c02783c22f97abd7f6b9659aecbca00 Mon Sep 17 00:00:00 2001 From: Euan Harris Date: Fri, 3 Nov 2023 11:27:14 +0000 Subject: [PATCH] Fix broken libc.so symlink in RHEL SDK built from Docker What looks like a search-replace error in 527128c7e21928d4e142f1165da5fa9c821cd076 added a spurious "await" in the target of the rhel-ubi9.sdk/usr/lib64/libc.so symlink: x86_64-unknown-linux-gnu/rhel-ubi9.sdk/usr/lib64/libc.so -> libc.await so.6 This causes the linker to be unable to find libc: % swift build --experimental-swift-sdk 5.9-RELEASE_rhel_ubi9_x86_64 Building for debugging... warning: Could not read SDKSettings.json for SDK at: /Users/euanh/Library/org.swift.swiftpm/swift-sdks/5.9-RELEASE_rhel_ubi9_x86_64.artifactbundle/5.9-RELEASE_rhel_ubi9_x86_64/x86_64-unknown-linux-gnu/rhel-ubi9.sdk :0: warning: glibc not found for 'x86_64-unknown-linux-gnu'; C stdlib may be unavailable :0: warning: glibc not found for 'x86_64-unknown-linux-gnu'; C stdlib may be unavailable warning: Could not read SDKSettings.json for SDK at: /Users/euanh/Library/org.swift.swiftpm/swift-sdks/5.9-RELEASE_rhel_ubi9_x86_64.artifactbundle/5.9-RELEASE_rhel_ubi9_x86_64/x86_64-unknown-linux-gnu/rhel-ubi9.sdk error: link command failed with exit code 1 (use -v to see invocation) ld.lld: error: unable to find library -lc clang-13: error: linker command failed with exit code 1 (use -v to see invocation) error: fatalError [5/6] Linking hello-world I don't see any other similar search-replace problems in 527128c7e21928d4e142f1165da5fa9c821cd076. --- .../SwiftSDKGenerator/Generator/SwiftSDKGenerator+Copy.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Copy.swift b/Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Copy.swift index 3cc643b..4278321 100644 --- a/Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Copy.swift +++ b/Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Copy.swift @@ -63,7 +63,7 @@ extension SwiftSDKGenerator { // `libc.so` is a linker script with absolute paths on RHEL, replace with a relative symlink let libcSO = sdkUsrLib64Path.appending("libc.so") try await removeFile(at: libcSO) - try await createSymlink(at: libcSO, pointingTo: "libc.await so.6") + try await createSymlink(at: libcSO, pointingTo: "libc.so.6") } try await generator.createDirectoryIfNeeded(at: sdkUsrLibPath)