Skip to content

Commit

Permalink
Merge pull request #1830 from Kobzol/find-llvm
Browse files Browse the repository at this point in the history
Update logic that finds libLLVM.so artifact
  • Loading branch information
Mark-Simulacrum authored Mar 7, 2024
2 parents 9580e15 + d1e8474 commit a172930
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions collector/src/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,20 @@ impl ToolchainComponents {
for entry in fs::read_dir(dir).context("Cannot read lib dir to find components")? {
let entry = entry?;
let path = entry.path();
if path.is_file() && path.extension() == Some(OsStr::new("so")) {
if path.is_file() {
if let Some(filename) = path.file_name().and_then(|s| s.to_str()) {
// libLLVM.so can have a weird suffix, like libLLVM.so.<suffix>, so we don't
// check its .so suffix directly.
if filename.starts_with("libLLVM") {
self.lib_llvm = Some(path);
} else if filename.starts_with("librustc_driver") {
self.lib_rustc = Some(path);
} else if filename.starts_with("libstd") {
self.lib_std = Some(path);
} else if filename.starts_with("libtest") {
self.lib_test = Some(path);
} else if path.extension() == Some(OsStr::new("so")) {
if filename.starts_with("librustc_driver") {
self.lib_rustc = Some(path);
} else if filename.starts_with("libstd") {
self.lib_std = Some(path);
} else if filename.starts_with("libtest") {
self.lib_test = Some(path);
}
}
}
}
Expand Down

0 comments on commit a172930

Please sign in to comment.