| 6 | |
| 7 | |
| 8 | fn try_gcc(lib: &str, msg: &str) { |
| 9 | |
| 10 | let out_dir = env::var("OUT_DIR").unwrap(); |
| 11 | let dest_path = Path::new(&out_dir).join("main.c"); |
| 12 | let mut f = File::create(&dest_path).unwrap(); |
| 13 | |
| 14 | f.write_all(b" |
| 15 | int main() { |
| 16 | } |
| 17 | ").unwrap(); |
| 18 | |
| 19 | let s = Command::new("gcc") |
| 20 | .args(&[dest_path.into_os_string().to_str().unwrap(), lib, "-o"]) |
| 21 | .arg(&format!("{}/main.o", out_dir)) |
| 22 | .status() |
| 23 | .unwrap(); |
| 24 | |
| 25 | assert!(s.success(), "\n\n".to_string() + msg); |
| 26 | } |
| 27 | |
| 28 | fn main() { |
| 29 | try_gcc("-lblas", "BLAS not found. On Ubuntu try 'sudo apt-get install libblas3' before continuing."); |