Open kwpal opened 1 year ago
Okay so, interesting story. Thanks to your issue I learned about --remap-path-prefix=
!
Here's what is happening: When Rust compiles your binary, for every occurrence of a panic it will include information for displaying a proper panic message. This panic includes a pointer to the line and file in question. So what you are seeing are the panic message strings that are placed into the binary by the compiler.
Now, why are these paths absolute? I have absolutely no clue! But this has been brought up before (here and here and probably many other times), so this isn't anything we're doing, but something the Rust compiler is doing.
To fix this: As mentioned in the issues I linked above there is a rust compiler flag called --remap-path-prefix=
that you can use to "strip"/replace the path prefix that includes your username.
You can set these flags like so:
RUSTFLAGS="--remap-path-prefix=/Users/jonas/Documents/GitHub/rust-updater/tauri-app/src-tauri/src=src --remap-path-prefix=/Users/jonas/.cargo=cargo --remap-path-prefix=/Users/jonas/.rustup=rustup" cargo tauri build
This will strip all the occurrences of your username from the final binary (at least it did on my machine)
Okay cool, I can hear you saying though "this is a stupid and incredibly unergonomic solution" and I would absolutely agree with you, arguably this should be fixed in rust. Maybe we can, as a stopgap solution, add these flags when the tauri cli compiles your app though 🤔
Describe the bug
Based on the recommand options from official website, I have set
strip = true
, but the compiled binary still contains my system username.binary screenshot:
Reproduction
src-tauri/target/release/bundle/macos/realapp.app/Contents/MacOS/realapp
Expected behavior
Should remove my username in complied binary.
Platform and versions
Stack trace
No response
Additional context
No response