hugoattal / milky-warp

Simple magnifier for presentations (so that people can read the tiny texts)
MIT License
370 stars 18 forks source link

Compiled successfully but failed to run #6

Open kero990 opened 11 months ago

kero990 commented 11 months ago

I tried to compile the project on an arm64 architecture linux platform, after eliminating some compilation errors, the compilation was successful, but the generated binary file could not be executed, the runtime error is as follows

$ ./milky-warp
thread 'main' panicked at src/main.rs:33:42:
called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Segmentation fault

I don't know why I got the "Permission denied" error, but when I ran it with sudo, the first error disappeared. The only error is that "Segmentation fault" In addition, there is an additional error message during compilation, but it does not affect the file generation, I do not know whether it is relevant

warning: unused variable: `cursor_pos`
  --> src/lib.rs:49:41
   |
49 | pub fn get_screen_index_from_cursor_pos(cursor_pos: (i32, i32)) -> u32 {
   |                                         ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_cursor_pos`                                                                                                             
   |
   = note: `#[warn(unused_variables)]` on by default

warning: `milky-warp` (lib) generated 1 warning (run `cargo fix --lib -p milky-warp` to apply 1 suggestion)
   Compiling milky-warp v1.0.0 (/home/kero990/milky-warp/src-tauri)
    Finished release [optimized] target(s) in 1m 16s

The current build platform is debian10, and this device cannot be upgraded to a newer version. I don't know if this is relevant or if the project compiles to arm64.

hugoattal commented 11 months ago

Hey, thank you for reporting it!

I admit, I did not quite test it on Linux, I just assumed it would work... I'm working on Windows, so I'm not sure how to fix your error, but if you want to tackle the issue, PRs are welcome 😄 !

hugoattal commented 11 months ago

After reading a bit more carrefully the issue:

You can try to update it like this:

pub fn get_screen_index_from_cursor_pos(_cursor_pos: (i32, i32)) -> u32 {
    return 0;
}
kero990 commented 11 months ago

I tried to modify src-tauri/src/lib.rs, this compilation did not report errors, but when I set RUST_BACKTRACE=full, I got the following error Finished release [optimized] target(s) in 11m 07s

thread '<unnamed>' panicked at 'Can't detect any appindicator library', src/build.rs:413:17
stack backtrace:
   0:     0xffffb0aeddc8 - <unknown>
   1:     0xffffb06e08d8 - <unknown>
   2:     0xffffb0ac5924 - <unknown>
   3:     0xffffb0af0340 - <unknown>
   4:     0xffffb0aeffa0 - <unknown>
   5:     0xffffb0aefc60 - <unknown>
   6:     0xffffb0af0af0 - <unknown>
   7:     0xffffb0af09b8 - <unknown>
   8:     0xffffb0af0950 - <unknown>
   9:     0xffffb0af0944 - <unknown>
  10:     0xffffb063690c - <unknown>
  11:     0xffffb0bb31d4 - <unknown>
  12:     0xffffb0cb1d78 - <unknown>
  13:     0xffffb066d704 - <unknown>
  14:     0xffffb0d4f734 - <unknown>
  15:     0xffffb0d53500 - <unknown>
  16:     0xffffb0af2f44 - <unknown>
  17:     0xffffb3d627e4 - start_thread
  18:     0xffffb3cb859c - <unknown>
  19:                0x0 - <unknown>

This is very similar to the error when you run the release file directly under RUST_BACKTRACE=full

oh, the new release file runs with a different error, it's like this now

~$ ./src-tauri/target/release/milky-warp 
thread 'main' panicked at src/main.rs:33:42:
called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
stack backtrace:
   0:     0xaaaad84a0a0c - std::backtrace_rs::backtrace::libunwind::trace::heaab0e590535aeb3
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0xaaaad84a0a0c - std::backtrace_rs::backtrace::trace_unsynchronized::h89cc7ae9ebb707d7
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0xaaaad84a0a0c - std::sys_common::backtrace::_print_fmt::h08c31be18fedf422
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:67:5
   3:     0xaaaad84a0a0c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc38bcf44d9e857e3
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:44:22
   4:     0xaaaad84c73d0 - core::fmt::rt::Argument::fmt::ha5b752f9cd7ef4a3
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/fmt/rt.rs:138:9
   5:     0xaaaad84c73d0 - core::fmt::write::h9fac187ae7486f3c
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/fmt/mod.rs:1094:21
   6:     0xaaaad849dcb8 - std::io::Write::write_fmt::h239e9fb6296b3a7f
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/io/mod.rs:1714:15
   7:     0xaaaad84a0840 - std::sys_common::backtrace::_print::h52f67cfa8753b0ab
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:47:5
   8:     0xaaaad84a0840 - std::sys_common::backtrace::print::hdea7481e2c957a93
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:34:9
   9:     0xaaaad84a1ec4 - std::panicking::default_hook::{{closure}}::h7c36fa733369c49e
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:270:22
  10:     0xaaaad84a1bec - std::panicking::default_hook::h303eee75f9a8f6a8
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:290:9
  11:     0xaaaad84a2488 - std::panicking::rust_panic_with_hook::h270c94381ec34744
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:707:13
  12:     0xaaaad84a2350 - std::panicking::begin_panic_handler::{{closure}}::h3653e3502bcc1625
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:599:13
  13:     0xaaaad84a0ef0 - std::sys_common::backtrace::__rust_end_short_backtrace::h6b8510f2f024eeeb
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:170:18
  14:     0xaaaad84a20a0 - rust_begin_unwind
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
  15:     0xaaaad8131dc4 - core::panicking::panic_fmt::ha96945d7a1b20293
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
  16:     0xaaaad81320e4 - core::result::unwrap_failed::h52241e4ea1d20f58
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/result.rs:1652:5
  17:     0xaaaad8229304 - milky_warp::update_screenshot::he53e34f0d1a3fe19
  18:     0xaaaad822710c - milky_warp::main::h8880e8e9bbb00f80
  19:     0xaaaad81e95a8 - std::sys_common::backtrace::__rust_begin_short_backtrace::h2813459d33853b1c
  20:     0xaaaad821a4d0 - std::rt::lang_start::{{closure}}::h3e0f359e67faeb89
  21:     0xaaaad84988fc - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h88e11b183391c045
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/ops/function.rs:284:13
  22:     0xaaaad84988fc - std::panicking::try::do_call::hf62418fc1f7ab0ba
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:502:40
  23:     0xaaaad84988fc - std::panicking::try::h96e06e195e92b5b2
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:466:19
  24:     0xaaaad84988fc - std::panic::catch_unwind::h81d0af01faa937a6
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panic.rs:142:14
  25:     0xaaaad84988fc - std::rt::lang_start_internal::{{closure}}::hf32b9834747c984e
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/rt.rs:148:48
  26:     0xaaaad84988fc - std::panicking::try::do_call::had623a98a0d3cc26
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:502:40
  27:     0xaaaad84988fc - std::panicking::try::ha216a98a719bb195
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:466:19
  28:     0xaaaad84988fc - std::panic::catch_unwind::h47218f3906a674ae
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panic.rs:142:14
  29:     0xaaaad84988fc - std::rt::lang_start_internal::h9020369f9618c61f
                               at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/rt.rs:148:20
  30:     0xaaaad8229410 - main
  31:     0xffff8a06ad24 - __libc_start_main
  32:     0xaaaad81324ec - <unknown>
Segmentation fault
kero990 commented 10 months ago

Attempting to compile on an x64 Linux machine, there was also a "Segmentation fault", which does not seem to be an issue with the arm64 architecture. This project should not be ready to run on Linux yet. Looking forward to your improvement, thank you very much