tauri-apps / tray-icon

Tray icons for Desktop Applications.
Apache License 2.0
211 stars 29 forks source link

Unable to run example directly from terminal, works from IDE (RustRover) #141

Closed kinocz closed 5 months ago

kinocz commented 5 months ago

I'm a newbie to Rust, so I probably did something stupid and should have done differently.

I have cloned the project and wanted to run:

/Users/kino/.cargo/bin/cargo run --color=always --package tray-icon --example tao

If I run this through IDE (RustRover), I'm able to run it properly, and the tray icon shows as expected.

When I do the same from the terminal, I receive bus error. I was able to track down that the problem is https://github.com/tauri-apps/tray-icon/blob/67b873b1e03be371a629fed870e0ab54e0cb2f56/examples/tao.rs#L48 . It does not matter what example I try to run. The bus error is always received when the try icon itself tries to build.

/Users/kino/.cargo/bin/cargo run --color=always --package tray-icon --example tao
    Finished dev [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/examples/tao`
[1]    34852 bus error  /Users/kino/.cargo/bin/cargo run --color=always --package tray-icon --example
./target/debug/examples/tao
[1]    35415 bus error  ./target/debug/examples/tao

Cargo/rust is installed with rustup

cargo --version
cargo 1.77.2 (e52e36006 2024-03-26)

rustc --version
rustc 1.77.2 (25ef9e3d8 2024-04-09)

rustup --version
rustup 1.27.0 (2024-03-08)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.77.2 (25ef9e3d8 2024-04-09)`

edit: I'm using MacOS 14.4.1 with M1 cpu aarch64-apple-darwin toolchain default

FabianLars commented 5 months ago

Are you using mac's default terminal? It works completely fine for me on the default terminal on macos 14.4.1 but with M2 pro 🤔

kinocz commented 5 months ago

OK, the problem is ohmyzsh (probably some plugin, zsh is fine). Thx, for pointing me in the right direction. Now, one wonders WTF... If I find it I will post it here.

kinocz commented 5 months ago

I was able to track it down...

I had

export DYLD_LIBRARY_PATH=/opt/homebrew/lib

in my .zshrc, because of the different tools I'm using. When I removed this, all started to work.