From c7e89acf7e41cb26e0a10fed29ab6101c8de4852 Mon Sep 17 00:00:00 2001 From: Hans Gaiser Date: Fri, 5 May 2023 11:14:44 +0200 Subject: [PATCH] Default to system installation for onnxruntime. --- rust/onnxruntime-sys/build.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/rust/onnxruntime-sys/build.rs b/rust/onnxruntime-sys/build.rs index 82d1e4278015c..a2b4bf54b15c9 100644 --- a/rust/onnxruntime-sys/build.rs +++ b/rust/onnxruntime-sys/build.rs @@ -402,16 +402,18 @@ fn prepare_libort_dir() -> PathBuf { ); match strategy.as_ref().map(String::as_str) { Ok("download") => prepare_libort_dir_prebuilt(), - Ok("system") => PathBuf::from(match env::var(ORT_RUST_ENV_SYSTEM_LIB_LOCATION) { + Ok("compile") => prepare_libort_dir_compiled(), + Ok("system") | Err(_) => PathBuf::from(match env::var(ORT_RUST_ENV_SYSTEM_LIB_LOCATION) { Ok(p) => p, - Err(e) => { - panic!( - "Could not get value of environment variable {:?}: {:?}", - ORT_RUST_ENV_SYSTEM_LIB_LOCATION, e - ); + Err(_) => { + println!("No value set for '{}', defaulting to /usr", ORT_RUST_ENV_SYSTEM_LIB_LOCATION); + "/usr".to_string() + // panic!( + // "Could not get value of environment variable {:?}: {:?}", + // ORT_RUST_ENV_SYSTEM_LIB_LOCATION, e + // ); } }), - Ok("compile") | Err(_) => prepare_libort_dir_compiled(), _ => panic!("Unknown value for {:?}", ORT_RUST_ENV_STRATEGY), } }