Closed efJerryYang closed 10 months ago
I'm having the exact same issue.
Hey, I'm having the same issues (even without tauri).
I think I found the culprit. Could you please try out the fix in #194 and let me know if that works for you? (@dladeira @efJerryYang)
Thanks!
Yes, it works. Thanks for your investigation!
Describe the bug I encountered a bug while using Tauri to build a desktop application on Linux. This issue only occurs in release mode; the debug build runs without any problem.
When invoking the
mouse_location()
from a tauri command function, aSegmentation fault (core dumped)
error appears. Switching to production debug mode using the VS Code debugging tool (following this guide Tauri - Debugging in VS Code) reveals that the error occurs at the address0x555500000000
, which seems to be a memory access error. No such error arises when using development debug mode.Error message in console:
Error message you can see from vscode debugger:
SIGNAL SIGSEGV: INVALID ADDRESS (FAULT ADDRESS: 0X555500000000)
The corresponding source code is as follows:
To Reproduce The process of constructing the application using
create-tauri-app
is shown below:Following the prompts, my settings were as follows:
Then I could successfully launch a desktop application by following the provided instructions. To reproduce this bug, I modified the greet function in
src-tauri/src/main.rs
as follows:Also, I added the corresponding enigo dependency in the Cargo.toml:
To compile successfully, I also modified the
"identifier"
in thesrc-tauri/tauri.conf.json
file, changing it to"org.test.dev",
.At this point, the minimalist application build was complete. The binary generated in debug mode using
cargo tauri dev
ran normally, and callingmouse_location
did not cause any problems. However, when I switched to release mode:Running the binary located in
src-tauri/target/release/
caused the segmentation fault.Expected behavior The release build should behave consistently with the development build, correctly obtaining the mouse's coordinate position. However, the release build results in a core dump.
Environment (please complete the following information):
The environment displayed by
cargo tauri info
is shown below:rustc 1.72.0-nightly (a97c36dd2 2023-06-07)
rustc 1.70.0 (90c541806 2023-05-31)
enigo = { version = "0.1.2", features = ["with_serde"] }
Additional context It's worth noting that when I added a print line to the
mouse_location
method in the enigo source code (linux.rs
), I was able to compile an application that worked. However, this seems absurd, and this kind of workaround should not be the solution.