spacedrive icon indicating copy to clipboard operation
spacedrive copied to clipboard

App tries loading `libonnxruntime` from hard-coded path, crashes if it is not found

Open xrtxn opened this issue 1 year ago • 4 comments

Describe the bug

I'm unable to package the binary on the aur because I get an error after installing [extra/onnxruntime] library. The library exists at /usr/lib/libonnxruntime.so.1.16.3

Reproduction

  1. Download the updated version (extra/onnxruntime is not listed as a dependency you need to install it manually): https://aur.archlinux.org/cgit/aur.git/commit/?h=spacedrive-bin&id=1230be338d558460c0f2222dff919abfd5d5bf75
  2. makepkg -si
  3. launch it

Expected behavior

No response

Platform and versions

Artix linux
Linux 6.7.0-zen3-1-zen x86_64

Stack trace

2024-01-28T18:15:56.839183Z  INFO sd_core: core/src/lib.rs:88: Starting core with data directory '/home/xrtxn/.local/share/spacedrive'
2024-01-28T18:15:56.840132Z ERROR sd_ai::utils: crates/ai/src/utils/mod.rs:22: Failed to canonilize relative path to exe, return raw path and hope: Os {
    code: 2,
    kind: NotFound,
    message: "No such file or directory",
}
2024-01-28T18:15:56.840221Z ERROR sd_core: core/src/lib.rs:205: panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-alpha.2/src/lib.rs:95:79:
could not load the library at `/usr/bin/../lib/spacedrive/libonnxruntime.so`: DlOpen { desc: "/usr/bin/../lib/spacedrive/libonnxruntime.so: cannot open shared object file: No such file or directory" } panic.file="/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-alpha.2/src/lib.rs:95" panic.column=79

Additional context

No response

xrtxn avatar Jan 28 '24 18:01 xrtxn

We don't maintain the AUR, or any Spacedrive versions outside of our GitHub and website (spacedrive.com).

Are you saying the issue is coming from the version in the AUR, or you're the maintainer and can't package it to update it for the AUR?

brxken128 avatar Jan 28 '24 18:01 brxken128

I am the maintainer and can't package it for the aur with the 0.2.0 version.

xrtxn avatar Jan 28 '24 18:01 xrtxn

@xrtxn the app has a hard-coded path for locating the onnxruntime lib at the moment: /usr/lib/spacedrive/libonnxruntime.so. This is not ideal for Linux, and the app should also look for the lib in the normal linker paths. Also, the app should not crash if onnxruntime is not installed in the system, considering the AI feature is optional when using Spacedrive. As a workaround, while this isn't fixed, you can create a symlink from /usr/lib/libonnxruntime.so -> /usr/lib/spacedrive/libonnxruntime.so and the app should work with [extra/onnxruntime].

HeavenVolkoff avatar Jan 29 '24 07:01 HeavenVolkoff

I'm experiencing a similar issue regarding libonnxruntime while attempting to compile Spacedrive from source on Arch Linux, see https://github.com/spacedriveapp/spacedrive/issues/2044. Perhaps these issues should be merged?

0xBA5E64 avatar Feb 05 '24 10:02 0xBA5E64