tauri-apps / tray-icon

Tray icons for Desktop Applications.
Apache License 2.0
225 stars 32 forks source link

Help with linker (cc) #48

Closed ademarsj closed 1 year ago

ademarsj commented 1 year ago

Hello, I don't think it's a library problem (if this type of issue for help isn't allowed, I delete it), but I would like some help.

I tried to reproduce the example "egui", but found some errors, so I did a minimal example: 

fn main() {
    let path = "/home/<your-path-to-folder>/src/icon.png";
    let icon = load_icon(std::path::Path::new(path));

    let tray_icon = TrayIconBuilder::new()
        .with_tooltip("system-tray - tray icon library!")
        .with_icon(icon)
        .build()
        .unwrap();
}

However, when i run cargo build i got this error:

"-Wl,-Bdynamic" "-lxdo" "-ldl" "-lgtk-3" "-lgdk-3" "-lpangocairo-1.0" "-lpango-1.0" "-lharfbuzz" "-latk-1.0" "-lcairo-gobject" "-lcairo" "-lgdk_pixbuf-2.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-latk-1.0" "-lgobject-2.0" "-lglib-2.0" "-lgdk-3" "-lpangocairo-1.0" "-lpango-1.0" "-lharfbuzz" "-lgdk_pixbuf-2.0" "-lcairo-gobject" "-lcairo" "-lgobject-2.0" "-lglib-2.0" "-lpango-1.0" "-lgobject-2.0" "-lglib-2.0" "-lharfbuzz" "-lgdk_pixbuf-2.0" "-lgobject-2.0" "-lglib-2.0" "-lcairo-gobject" "-lcairo" "-lgobject-2.0" "-lglib-2.0" "-lgobject-2.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/ademar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/ademar/Projetos/bosta/target/debug/deps/bosta-454ed0ac8f88c5a2" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -lxdo: No such file or directory
          collect2: error: ld returned 1 exit status

I installed a lot of dependencies (gtk, libc-dev, gcc-multilib and anothers) trying to solve this problem, but with no success.

I tried run the command cc with all the flags and got an error too:

 /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
collect2: error: ld returned 1 exit status

OS: Pop OS 22.04 (Cosmic)

Sorry for the poor English.

FabianLars commented 1 year ago

It's complaining about the xdo lib being missing. Try running sudo apt install libxdo-dev please.

ademarsj commented 1 year ago

Thank you so much @FabianLars, worked.