spacedrive icon indicating copy to clipboard operation
spacedrive copied to clipboard

Compiling `sd-server` from source fails on Arch Linux due to hard-coded path for `libonnxruntime`

Open 0xBA5E64 opened this issue 1 year ago • 1 comments

Describe the bug

Attempting to compile Spacedrive from source by following the instructions in CONTRIBUTING.md fails on my Arch Linux machine, citing issues with "libonnxruntime".

Spacedrive used to compile & run from source just fine for me before, just about before/around the release of v0.2.0 if i recall correctly. However, following a recent git pull, that no longer appears to be the case.

Reproduction

Run the following commands in the cloned git repo:

$ git pull
$ pnpm clean -f && cargo clean && git clean -f
$ pnpm i
$ pnpm prep
$ cargo run -p sd-server

Expected behavior

sd-server runs and remains open in the terminal to be connected to by either the web or desktop client.

Platform and versions

$ pnpm --version && cargo --version && rustc --version
8.15.1
cargo 1.75.0 (1d8b05cdd 2023-11-20)
rustc 1.75.0 (82e1608df 2023-12-21)

Stack trace

2024-02-03T18:11:38.925151Z  INFO sd_core: core/src/lib.rs:88: Starting core with data directory '/home/dovah/Code/spacedrive/apps/server/sdserver_data'
2024-02-03T18:11:38.926013Z  WARN sd_core::util::version_manager: core/src/util/version_manager.rs:159: Config file for sd_core::node::config::NodeConfig does not exist, trying to create a new one with version -> V2
2024-02-03T18:11:38.938559Z ERROR sd_core: core/src/lib.rs:211: panicked at /home/dovah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-alpha.2/src/lib.rs:95:79:
could not load the library at `/home/dovah/Code/spacedrive/apps/.deps/lib/libonnxruntime.so.1.16.3`: DlOpen { desc: "/home/dovah/Code/spacedrive/apps/.deps/lib/libonnxruntime.so.1.16.3: cannot allocate memory in static TLS block" } panic.file="/home/dovah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-alpha.2/src/lib.rs:95" panic.column=79
fatal runtime error: failed to initiate panic, error 3
Aborted (core dumped)

Additional context

Before this compilation error began happening, I was expeiencing a seemlingly unrelated error due to Prisma's OpenSSL requirements for which I applied an admittedly hacky fix outlined in https://github.com/spacedriveapp/spacedrive/issues/1929#issuecomment-1900363077. This issue was supposedly fixed in https://github.com/spacedriveapp/spacedrive/pull/1958, and so although I believe it to be irrelevant in this case, I'll add it onto here for context.

0xBA5E64 avatar Feb 03 '24 19:02 0xBA5E64

Following @HeavenVolkoff's workaround from here: https://github.com/spacedriveapp/spacedrive/issues/2006#issuecomment-1914077727, I tried symlinking libonnxruntime.so from my system (/usr/lib/) into apps/.deps/lib:

$ rm ./apps/.deps/lib/libonnxruntime.so
$ ln -s /usr/lib/libonnxruntime.so ./apps/.deps/lib/libonnxruntime.so
$ rm ./apps/.deps/lib/libonnxruntime.so.1.16.3
$ ln -s /usr/lib/libonnxruntime.so.1.16.3 ./apps/.deps/lib/libonnxruntime.so.1.16.3

This appears to've gotten things to run for me, and I'm now able to spin up the web frontend in another window with pnpm web dev and perform a library setup!

Indeed, it would appear the root issue with all of this is libonnxruntime.so's path being hard-coded for the time-being.

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