1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Tauri を WSL2 で動かす

Posted at

今年に入って 10 回ぐらい windows11 入れなおして、毎回環境構築するのめんどくさくなってきたのでメモ。
OS 入れなおしてまっさらな状態から wsl --install した直後を考慮

環境

  • Windows11 Home
  • WSL2 (Ubuntu 22.04.2 LTS)

Rust 環境を作る

公式通り

terminal
sudo apt update
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

npm をインストールする

npm のインストール

公式を参照

terminal
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash

これをやったら command -v nvm にて動作確認。 nvm と帰ってきたら多分大丈夫。

(VSCode + Remote WSL使っている人向け)
上記コマンドのインストールが正常に行われたにも関わらず、 nvm と帰ってこない場合、vscode を開きなおすと解決することがある。window reload だと意味がないので注意

node.js の lts リリースを入れる

terminal
nvm install --lts

npm run tauri dev ができる状態にする

詳細は公式参照

新しくプロジェクト作るのであれば以下コマンド

terminal
npm create tauri-app@latest

いろいろ怒られるので必要なやつをいっぱい入れる


error: linker cc not found

これは普通に gcc 入ってなかった

terminal
sudo apt install build-essential

なんかいっぱい出るエラー

terminal
error: could not compile `quote` (build script) due to previous error
                warning: build failed, waiting for other jobs to finish...
                error: could not compile `serde` (build script) due to previous error
                error: could not compile `proc-macro2` (build script) due to previous error
                error: could not compile `libc` (build script) due to previous error
                error: could not compile `futures-core` (build script) due to previous error
                error: could not compile `futures-task` (build script) due to previous error
                error: could not compile `getrandom` (build script) due to previous error
                error: could not compile `memchr` (build script) due to previous error
                error: could not compile `target-lexicon` (build script) due to previous error
                error: could not compile `syn` (build script) due to previous error

これらを入れてみる

terminal
sudo apt install pkg-config \
                libdbus-1-dev \
                libgtk-3-dev \
                libsoup2.4-dev \
                libjavascriptcoregtk-4.0-dev \
                libwebkit2gtk-4.0-dev

failed to run custom build command for alsa-sys v0.3.1

terminal
sudo apt install libasound2-dev

これで多分通る


あとなんか足りないやつ

terminal
sudo apt install libwebkit2gtk-4.0-dev \
            build-essential \
            curl \
            wget \
            file \
            libssl-dev \
            libgtk-3-dev \
            libayatana-appindicator3-dev \
            librsvg2-dev

これぐらいでビルド通ると思う。

感想

なんで週に 1 回 OS 入れなおしてるんだろ。
次は Manjaro でもいれよっかな。

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?