I wanted to try creating a desktop app with Rust, and found out there's Tauri and Yew. Both look cool!
- Tauri is used for building desktop apps (if you don't know tauri, you might have heard of electron).
- Yew is used for building native client webapps using rust. Reminds me of React.
Since there was no official documentation on how to configure a Tauri/Yew project, I wanted to post instructions for Linux users. I did run into some specific problems like:
- missing system packages
- packages installed with errors etc.
My distro is Ubuntu 22.04.
You might not run into any issues, so just following the quickstart should be fine.
I did run into issues on my laptop, and no issues when I tried the same procedure on my desktop computer. Same distro versions, but maybe "some system update broke" on my laptop.
Prerequisites
Install rust, or if you already have Rust installed:
rustup update stable rustup target add wasm32-unknown-unknown
Target wasm32-unknown-unknown is needed when building tauri apps, and quoting:
A “bare wasm” target representing a WebAssembly output that makes zero assumptions about its environment.
https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/wasm32_unknown_unknown/index.html
unknown-unknown might be compile on any, run on any machine.
Some system packages are also needed, a little bit later on that...
Rust version I was working with was 1.65.
Getting Started
There are some instructions on Quick Start | Tauri Apps, and they go like this:
cargo install create-tauri-app cargo create-tauri-app
Then you'll pick yew, and create-tauri-app will generate all source code.
Next edit src-tauri/Cargo.toml
, set rustc version to 1.65 or whatever version rustc --version
shows. Bump all dependencies, and then install:
cargo install tauri-cli trunk
cargo update
cargo tauri dev
When first running cargo tauri dev,
I got an error like:
Error led me to this github issue. And yes, libgtk-3-dev
was installed with errors!
libgtk-3-dev 22.04 "The following packages have unmet dependencies"
As the error says: you have installed listed dependencies, but you'll have to downgrade them!
sudo apt install libpcre2-8-0=10.39-3ubuntu0.1 -y sudo apt install libpcre2-16-0=10.39-3ubuntu0.1 -y sudo apt install libpcre2-32-0=10.39-3ubuntu0.1 -y sudo apt install libpcre3=2:8.39-13ubuntu0.22.04.1 -y
And finally sudo apt install --reinstall libgtk-3-dev
Another try at cargo tauri dev
Nope! Another error in terminal! And onto installing another set of packages...
sudo apt install -y libjavascriptcoregtk-4.0-dev libxml2=2.9.13+dfsg-1ubuntu0.2 libsoup2.4-dev libwebkit2gtk-4.0-dev --allow-downgrades
Finally
And, finally hit one more time cargo tauri dev
, I promise it will work!