Skip to content

Latest commit

 

History

History
186 lines (130 loc) · 4.02 KB

BUILDING.md

File metadata and controls

186 lines (130 loc) · 4.02 KB

Building

Prerequisites

Bun | Cargo | Clang | Cmake

Windows:

Tools: vcpkg

vcpkg packages

C:\vcpkg\vcpkg.exe install opencl

Winget packages

winget install -e --id JernejSimoncic.Wget
winget install -e --id 7zip.7zip

Linux:

Based on tauri/prerequisites/#setting-up-linux

sudo apt-get update
sudo apt-get install -y ffmpeg libopenblas-dev # runtime
sudo apt-get install -y pkg-config build-essential libglib2.0-dev libgtk-3-dev libwebkit2gtk-4.1-dev clang cmake libssl-dev # tauri
sudo apt-get install -y libavutil-dev libavformat-dev libavfilter-dev libavdevice-dev # ffmpeg

Build

Install dependencies from desktop folder

bun install

Execute pre build scripts and follow the instructions it provide

bun scripts/pre_build.js

Build with Nvidia support

See whisper.cpp#nvidia-support

  1. Enable cuda feature in Cargo.toml

  2. Install cuda

  3. Add to tauri.windows.conf.json

tauri.windows.conf.json
{
	"bundle": {
		"resources": {
			"ffmpeg\\bin\\x64\\*.dll": "./",
			"openblas\\bin\\*.dll": "./",
			"clblast\\bin\\*.dll": "./",
			"C:\\vcpkg\\packages\\opencl_x64-windows\\bin\\*.dll": "./",
			"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.5\\bin\\cudart64_*": "./",
			"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.5\\bin\\cublas64_*": "./",
			"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.5\\bin\\cublasLt64_*": "./"
		}
	}
}
  1. Build in Powershell
$env:CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.5"
$env:CudaToolkitDir = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.5"
bun run scripts/pre_build.js --build

Gotchas

On Ubuntu you may need to copy some libraries for ffmpeg_next library

sudo cp -rf /usr/include/x86_64-linux-gnu/libsw* /usr/include/
sudo cp -rf /usr/include/x86_64-linux-gnu/libav* /usr/include/

If the CPU failed to execute an instruction, then build with the following environment variable

WHISPER_NO_AVX = "ON"
WHISPER_NO_AVX2 = "ON"
WHISPER_NO_FMA = "ON"
WHISPER_NO_F16C = "ON"

Rust analyzer failed to run on windows

  1. Execute cargo clean
  2. Add to settings.json:
"rust-analyzer.cargo.extraEnv": {
	"FFMPEG_DIR": "C:\\Users\\User\\Documents\\code\\vibe\\desktop\\src-tauri\\ffmpeg",
	"OPENBLAS_PATH": "C:\\Users\\User\\Documents\\code\\vibe\\desktop\\src-tauri\\openblas",
	"CLBlast_DIR": "C:\\Users\\User\\Documents\\code\\vibe\\desktop\\src-tauri\\clblast",
	"LIBCLANG_PATH": "C:\\Program Files\\LLVM\\bin"
}
  1. Relaunch VSCode

Test

export RUST_LOG=trace
cargo test -- --nocapture

Lint

cargo fmt
cargo clippy

Create new release

  1. Increment verison in tauri.conf.json and commit
  2. Create new git tag and push
git tag -a v<version> -m "v<version>" && git push --tags

It will create releases for Windows, Linux, and macOS

Along with latest.json file (used for auto updater).

When Release action finish, it will run Deploy landing action

and update downloads links in landing page.

Landing

Compress images

bunx tinypng-go static/*.png

Normalize wav file for tests

ffmpeg -i file.wav -ar 16000 -ac 1 -c:a pcm_s16le normal.wav

Edit PR before merge

gh pr checkout <url>
git push <fork url> HEAD:<branch>

Update packages

bunx ncu -u -t newest
cd src-tauri
cargo install cargo-edit
rm -rf ../Cargo.lock
CARGO_NET_GIT_FETCH_WITH_CLI=true
CARGO_NET_GIT_FETCH_WITH_CLI=true cargo upgrade
# OR
cargo +nightly -Zunstable-options update --breaking