Fix call to rustc-objcopy to strip binary on Linux
- Fixes https://github.com/DioxusLabs/dioxus/issues/5065
Error was:
/home/nico/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/bin/rust-objcopy: error while loading shared libraries: libLLVM.so.20.1-rust-1.90.0-stable: cannot open shared object file: No such file or directory
Fix is to set the LD_LIBRARY_PATH env variable to the directory that contains that file when executing the command.
It would be possible to append to LD_LIBRARY_PATH (like with PATH). However, I think there's no need in this case as we're calling into a specific binary, not setting a general env var.
It would additionally be nice to print stdout/stderr when the command fails so that we get a debuggable error message. But I'm not sure what the idiomatic way to log in the CLI is.
I confirmed that this fixes the build error in https://github.com/DioxusLabs/dioxus/issues/5065 by installing the dioxus-cli from this MR like so:
cargo install dioxus-cli --git https://github.com/nicoburns/dioxus.git --rev=bd8ad33
Wasm-opt still fails in release builds but I'm now thinking that's a separate issue.
It would additionally be nice to print stdout/stderr when the command fails so that we get a debuggable error message. But I'm not sure what the idiomatic way to log in the CLI is.
Tracing is hooked up to the CLI so you should be able to do tracing::error! if we can't run the command