Skip to content

Commit b942b1c

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 b942b1c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/Commands/Utilities/TestingSupport.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ 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: ":")
143+
env["LD_DEBUG"] = "all"
136144
#endif
137145
return env
138146
#else

0 commit comments

Comments
 (0)