Skip to content

Commit

Permalink
Teach driver to locate the scanner library when the compiler is invok…
Browse files Browse the repository at this point in the history
…ed from the build dir
  • Loading branch information
nkcsgexi committed Sep 10, 2021
1 parent af42b87 commit 687e70b
Showing 1 changed file with 12 additions and 2 deletions.
Expand Up @@ -319,10 +319,20 @@ public extension Driver {
} else {
sharedLibExt = ".so"
}
return try getRootPath(of: toolchain, env: env).appending(component: "lib")
let libScanner = "lib_InternalSwiftScan\(sharedLibExt)"
// We first look into position in toolchain
var libPath
= try getRootPath(of: toolchain, env: env).appending(component: "lib")
.appending(component: "swift")
.appending(component: hostTriple.osNameUnversioned)
.appending(component: "lib_InternalSwiftScan" + sharedLibExt)
.appending(component: libScanner)
if localFileSystem.exists(libPath) {
return libPath
}
// In case we are using a compiler from the build dir, we should also try
// this path.
return try getRootPath(of: toolchain, env: env).appending(component: "lib")
.appending(component: libScanner)
}

fileprivate static func getRootPath(of toolchain: Toolchain, env: [String: String])
Expand Down

0 comments on commit 687e70b

Please sign in to comment.