Skip to content

Commit 210a2f0

Browse files
committed
Workaround an issue regarding libXCTest.so
We're seeing an issue where the XCTest library doesn't use absolute paths to link dependent Swift libs on Linux which means we need to explicitly set `LD_LIBRARY_PATH` to work around that.
1 parent bd6487b commit 210a2f0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/Commands/Utilities/TestingSupport.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ enum TestingSupport {
133133
if let location = toolchain.xctestPath {
134134
env.prependPath("Path", value: location.pathString)
135135
}
136+
#elseif os(Linux)
137+
var libraryPaths = ["/usr/lib/swift/linux"]
138+
if let path = env["PATH"], let firstPathEntry = path.components(separatedBy: ":").first {
139+
libraryPaths.append("\(firstPathEntry)/../lib/swift/linux")
140+
}
141+
// Pass this explicitly on Linux because XCTest started requiring it, rdar://103054033
142+
env["LD_LIBRARY_PATH"] = libraryPaths.joined(separator: ":")
136143
#endif
137144
return env
138145
#else

0 commit comments

Comments
 (0)