diff --git a/libafl_cc/build.rs b/libafl_cc/build.rs index 551d812f87..ef5ede4ba1 100644 --- a/libafl_cc/build.rs +++ b/libafl_cc/build.rs @@ -39,14 +39,23 @@ fn find_llvm_config_brew() -> Result { if brew_cellar_location.is_empty() { return Err("Empty return from brew --cellar".to_string()); } - let cellar_glob = format!("{brew_cellar_location}/llvm/*/bin/llvm-config"); - let glob_results = glob(&cellar_glob).unwrap_or_else(|err| { - panic!("Could not read glob path {} ({err})", &cellar_glob); + let location_suffix = "*/bin/llvm-config"; + let cellar_glob = vec![ + // location for explicitly versioned brew formulae + format!("{brew_cellar_location}/llvm@*/{location_suffix}"), + // location for current release brew formulae + format!("{brew_cellar_location}/llvm/{location_suffix}"), + ]; + let glob_results = cellar_glob.iter().flat_map(|location| { + glob(location).unwrap_or_else(|err| { + panic!("Could not read glob path {location} ({err})"); + }) }); match glob_results.last() { Some(path) => Ok(path.unwrap()), None => Err(format!( - "No llvm-config found in brew cellar with pattern {cellar_glob}" + "No llvm-config found in brew cellar with patterns {}", + cellar_glob.join(" ") )), } }