Tauri Windows Installer ドキュメント補足

プログラミング
スポンサードリンク

基本的に公式ドキュメント通りやればOK – 公式ドキュメント

一部うまく動かなかったところがあったのでメモしておきます。

スポンサードリンク

前提

  • wsl
  • Tauri 2.0

※環境構築やアプリの作成などは書いておりません

公式ドキュメントの補足

①error: unexpected argument ‘cargo-xwin’ found

$ npm run tauri build --runner cargo-xwin --target x86_64-pc-windows-msvc 
> timer-app@0.1.0 tauri 
> tauri build cargo-xwin x86_64-pc-windows-msvc 

error: unexpected argument 'cargo-xwin' found 
Usage: cargo build [OPTIONS] 
For more information, try '--help'. failed to build app: failed to build app Error failed to build app: failed to build app

修正

npm run tauri build -- --runner cargo-xwin --target x86_64-pc-windows-msvc

“–runner” の前に “–” を追加

②error: failed to run custom build command for `my-app v0.1.0 (my-app/src-tauri)`

warning: timer-app@0.1.0: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `clang-cl` installed?

error: failed to run custom build command for `my-app v0.1.0 (my-app/src-tauri)`
warning: build failed, waiting for other jobs to finish...
failed to build app: failed to build app
    Error failed to build app: failed to build app
  1. ツールをインストール
sudo apt update
sudo apt install clang lld

2. clang-clのシンボリックを作成

sudo ln -s /usr/bin/clang /usr/bin/clang-cl

3. 環境変数を設定

export CC=clang
export CXX=clang++
export AR=llvm-ar
export RANLIB=llvm-ranlib

その後再起動か source ~/.bashrc を実行

5. Rust ターゲットの追加とcargo-xwinをインストール

rustup target add x86_64-pc-windows-msvc
cargo install cargo-xwin

その後再ビルド

npm run tauri build -- --runner cargo-xwin --target x86_64-pc-windows-msvc

コメント

タイトルとURLをコピーしました