MCPcopy Create free account
hub / github.com/daniel-e/rustml / try_gcc

Function try_gcc

build.rs:8–26  ·  view source on GitHub ↗
(lib: &str, msg: &str)

Source from the content-addressed store, hash-verified

6
7
8fn 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
28fn main() {
29 try_gcc("-lblas", "BLAS not found. On Ubuntu try 'sudo apt-get install libblas3' before continuing.");

Callers 1

mainFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected