diff --git a/linux-hello-cli/src/main.rs b/linux-hello-cli/src/main.rs index 5084774..c529b89 100644 --- a/linux-hello-cli/src/main.rs +++ b/linux-hello-cli/src/main.rs @@ -125,6 +125,29 @@ fn get_real_username() -> String { #[tokio::main] async fn main() -> Result<()> { + // Set ONNX Runtime library path if not already set + if std::env::var("ORT_DYLIB_PATH").is_err() { + let known_paths = [ + "/usr/local/lib/linux-hello/libonnxruntime.so", + "/usr/lib/linux-hello/libonnxruntime.so", + ]; + for path in known_paths { + if std::path::Path::new(path).exists() { + std::env::set_var("ORT_DYLIB_PATH", path); + break; + } + } + // Also check user-local install + if std::env::var("ORT_DYLIB_PATH").is_err() { + if let Ok(home) = std::env::var("HOME") { + let user_path = format!("{}/.local/lib/linux-hello/libonnxruntime.so", home); + if std::path::Path::new(&user_path).exists() { + std::env::set_var("ORT_DYLIB_PATH", &user_path); + } + } + } + } + let cli = Cli::parse(); // Initialize logging diff --git a/linux-hello-daemon/src/main.rs b/linux-hello-daemon/src/main.rs index 17efec4..3adcbb1 100644 --- a/linux-hello-daemon/src/main.rs +++ b/linux-hello-daemon/src/main.rs @@ -20,6 +20,19 @@ use tracing_subscriber::FmtSubscriber; #[tokio::main] async fn main() -> Result<()> { + // Set ONNX Runtime library path if not already set + if std::env::var("ORT_DYLIB_PATH").is_err() { + for path in [ + "/usr/local/lib/linux-hello/libonnxruntime.so", + "/usr/lib/linux-hello/libonnxruntime.so", + ] { + if std::path::Path::new(path).exists() { + std::env::set_var("ORT_DYLIB_PATH", path); + break; + } + } + } + // Initialize logging let _subscriber = FmtSubscriber::builder() .with_max_level(Level::INFO)