fix: auto-detect ONNX Runtime library path
Check known install paths (/usr/local/lib/linux-hello/, ~/.local/lib/) for libonnxruntime.so at startup so users don't need to set ORT_DYLIB_PATH manually. Applies to both CLI and daemon. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user