new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Tauri · all subjects

building/setup

196 notes in this subject, read out of this brain and free to use. This is page 2 of 4.

Building Tauri app from source in PKGBUILD

When building a Tauri app from source in PKGBUILD, declare these build dependencies in the `makedepends` variable: git, openssl, appmenu-gtk-module, libappindicator-gtk3, librsvg, cargo, pnpm, and nodejs. Then use `pnpm tauri build -b deb` in the build() function to generate the Debian package.

Tauri AUR post-install hooks

A Tauri app packaged for AUR should include an .install script with post_install(), post_upgrade(), and post_remove() functions that run `gtk-update-icon-cache -q -t -f usr/share/icons/hicolor` and `update-desktop-database -q` to properly register icons and desktop entries.

glibc compatibility when building Tauri Linux applications

Build your Tauri application on the oldest base system you intend to support to avoid increasing the minimum glibc version requirement. Building on a newer system may result in runtime errors like '/usr/lib/libc.so.6: version GLIBC_2.33 not found' when running on older systems.

Adding custom files to Debian package

Custom files and folders can be included in the Debian package by providing a list in tauri.conf.json under bundle > linux > deb > files. The configuration maps the target path in the Debian package to the source path relative to tauri.conf.json. Example: {"bundle": {"linux": {"deb": {"files": {"/usr/share/README.md": "../README.md", "/usr/share/assets": "../assets/"}}}}}

Rust targets for ARM cross-compilation

For ARMv7 (32-bit) cross-compilation, add the target with: rustup target add armv7-unknown-linux-gnueabihf. For ARMv8 (ARM64, 64-bit), use: rustup target add aarch64-unknown-linux-gnu.

Custom system dependencies in Debian package configuration

Additional system dependencies can be specified in tauri.conf.json under bundle > linux > deb.

ARM linker installation for Tauri cross-compilation

Install the appropriate linker for your target architecture: gcc-arm-linux-gnueabihf for ARMv7, or gcc-aarch64-linux-gnu for ARMv8 (ARM64).

Cargo configuration for ARM cross-compilation

Create or edit <project-root>/.cargo/config.toml and add: [target.armv7-unknown-linux-gnueabihf] linker = "arm-linux-gnueabihf-gcc" for ARMv7, or [target.aarch64-unknown-linux-gnu] linker = "aarch64-linux-gnu-gcc" for ARMv8.

Enable architecture in dpkg for ARM cross-compilation

Enable the target architecture in the package manager: sudo dpkg --add-architecture armhf for ARMv7, or sudo dpkg --add-architecture arm64 for ARMv8 (ARM64).

OpenSSL installation for ARM cross-compilation

For ARM cross-compilation, either install OpenSSL development headers system-wide (sudo apt install libssl-dev:armhf for ARMv7 or sudo apt install libssl-dev:arm64 for ARMv8), or enable the vendored feature for the OpenSSL Rust crate by adding openssl-sys = {version = "0.9", features = ["vendored"]} to the dependencies section in Cargo.toml.

WebKitGTK installation for ARM cross-compilation

Install the required WebKitGTK library for your target architecture: sudo apt install libwebkit2gtk-4.1-dev:armhf for ARMv7, or sudo apt install libwebkit2gtk-4.1-dev:arm64 for ARMv8 (ARM64).

PKG_CONFIG_SYSROOT_DIR for ARM cross-compilation

Set the PKG_CONFIG_SYSROOT_DIR environment variable before building: export PKG_CONFIG_SYSROOT_DIR=/usr/arm-linux-gnueabihf/ for ARMv7, or export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu/ for ARMv8 (ARM64).

Build commands for ARM targets

Build the app for the target architecture using: cargo tauri build --target armv7-unknown-linux-gnueabihf for ARMv7, or cargo tauri build --target aarch64-unknown-linux-gnu for ARMv8 (ARM64).

Recommended build environments for Linux Tauri applications

Docker containers or GitHub Actions are recommended for building Tauri applications for Linux to manage glibc compatibility and system dependencies consistently.

Debian package default dependencies

The Tauri Debian bundler automatically specifies the dependencies libwebkit2gtk-4.1-0 and libgtk-3-0. If the app uses the system tray, libappindicator3-1 is also included as a dependency.

Debian packaging includes application icons and desktop file

The stock Debian package generated by the Tauri bundler automatically includes the application's icons and generates a Desktop file.

Minimum supported Debian/Ubuntu versions for Tauri v2 Linux builds

Ubuntu 22.04 and Debian 12 are suitable baseline systems for building Tauri v2 applications for Linux because they provide libwebkit2gtk-4.1-dev from their standard package repositories. Building on a newer base system can raise the minimum glibc version required by the app, potentially causing runtime errors on older systems.

Generate separate bundles per architecture

By default, the generated AAB and APK are universal, containing all supported targets. To generate individual bundles per target, use the `--split-per-abi` argument: `cargo tauri android build -- --apk --split-per-abi`. This is only useful for testing or distribution outside Google Play as it reduces file size.

Set custom minimum SDK version

To configure a newer minimum supported Android version, set `tauri.conf.json > bundle > android > minSdkVersion`. For example, to require Android 9 (SDK 28): {"bundle": {"android": {"minSdkVersion": 28}}}.

Android App Bundle output path

After building, the Android App Bundle file is located at `gen/android/app/build/outputs/bundle/universalRelease/app-universal-release.aab`.

Manual first Google Play upload requirement

The first upload to Google Play must be made manually via the Google Play Console website so it can verify the app signature and bundle identifier. Tauri currently does not offer a way to automate the process of creating Android releases; this would require leveraging the Google Play Developer API.

Google Play requirements

To distribute Android apps on Google Play, you must create a Play Console developer account and set up code signing.

Update app icon for Android

After running `tauri android init` to setup the Android Studio project, you can use the `tauri icon` command to update app icons. Example: `cargo tauri icon /path/to/app-icon.png`.

Build Android App Bundle (AAB) for Google Play

To build an Android App Bundle (AAB) for uploading to Google Play, run: `cargo tauri android build -- --aab`. The AAB format is the recommended bundle file to upload to Google Play.

Version code derivation from tauri.conf.json

Tauri derives the version code from the value defined in `tauri.conf.json > version` using the formula: versionCode = major*1000000 + minor*1000 + patch. A custom version code can be set in `tauri.conf.json > bundle > android > versionCode` if a different version code scheme is needed, such as sequential codes.

Build APKs for testing or external distribution

APKs can be generated for testing or distribution outside the store using the `--apk` argument: `cargo tauri android build -- --apk`. APKs are not the recommended format for Google Play uploads.

Tauri Android supported architectures

By default, Tauri builds Android apps for all supported architectures: aarch64, armv7, i686, and x86_64. Use the `--target` argument to compile for a subset of targets, for example: `cargo tauri android build -- --aab --target aarch64 --target armv7`.

Minimum Android version for Tauri

The minimum supported Android version for Tauri apps is Android 7.0 (codename Nougat, SDK 24).

Cloud services distribution option

CrabNebula Cloud is available as a cloud service option to globally distribute Tauri applications with built-in support for auto updates.

Build commands for desktop and mobile

Tauri builds applications using the `tauri build`, `tauri android build`, and `tauri ios build` commands invoked through the CLI. These commands can be run via npm (npm run tauri build), yarn (yarn tauri build), pnpm (pnpm tauri build), deno (deno task tauri build), bun (bun tauri build), or cargo (cargo tauri build).

Build automatically bundles by default

By default, the `tauri build` command automatically bundles the application for all configured formats. The build and bundle steps can be split by using the `--no-bundle` flag on the build command, then running the `tauri bundle` command separately with the `--bundles` parameter to specify which formats to bundle.

Bundling with custom configuration

The `tauri bundle` command accepts a `--bundles` parameter to specify bundle formats (e.g., `app,dmg` for macOS App and DMG) and a `--config` parameter to use an alternative configuration file (e.g., `src-tauri/tauri.appstore.conf.json` for App Store distribution).

Application version configuration sources

Application version can be defined in the `tauri.conf.json > version` configuration option, which is the recommended approach. If that config value is not set, Tauri uses the `package > version` value from the `src-tauri/Cargo.toml` file instead. Some platforms have limitations and special cases for version strings that are documented on individual platform distribution pages.

Linux distribution formats supported

Tauri supports distributing Linux applications in the following formats: Debian package, Snap, AppImage, Flatpak, RPM, and Arch User Repository (AUR).

macOS distribution methods

Tauri supports two macOS distribution methods: direct App Store distribution or DMG installer as a direct download. Both methods require code signing, and distributing outside the App Store additionally requires notarization.

Windows distribution options

Tauri supports distributing Windows applications to the Microsoft Store or as configured Windows installers.

Android distribution to Google Play

Tauri Android applications are distributed to Google Play.

iOS distribution to App Store

Tauri iOS applications are uploaded and distributed to the App Store.

macOS app bundle directory structure

The macOS app bundle has the structure: <productName>.app/Contents/ contains Info.plist and additional files from tauri.conf.json bundle macOS files config. <productName>.app/MacOS/ contains the app executable named <app-name>. <productName>.app/Resources/ contains icon.icns and resources from tauri.conf.json bundle resources config. <productName>.app/ also contains _CodeSignature (codesign information), Frameworks, PlugIns, and SharedSupport directories.

macOS app bundle build command

To package a Tauri app as a macOS application bundle, run the command `tauri build --bundles app` on a Mac computer. Package managers available: npm run tauri build -- --bundles app, yarn tauri build --bundles app, pnpm tauri build --bundles app, deno task tauri build --bundles app, bun tauri build --bundles app, or cargo tauri build --bundles app.

Flatpak GNOME runtime and SDK versions

For Tauri Flatpak builds, use GNOME Platform runtime version 47 and GNOME SDK version 47. The GNOME 46 runtime includes all dependencies of the standard Tauri app with their correct versions.

Flatpak required socket permissions for Tauri

Tauri Flatpak builds require the following socket permissions: --socket=wayland for showing the window on Wayland, and --socket=fallback-x11 for showing the window on legacy windowing systems. The --share=ipc permission is also required.

Flatpak optional device permission for OpenGL

The --device=dri permission enables OpenGL support in Flatpak builds, but is not necessary for all projects.

Flatpak tray icon permissions

If a Tauri app uses the tray icon feature, add the permission --talk-name=org.kde.StatusNotifierWatcher and --filesystem=xdg-run/tray-icon:create to the Flatpak manifest finish-args. Alternatively, configure the tray icon to save to the app cache directory instead of XDG_RUNTIME_DIR by setting TrayIconBuilder's temp_dir_path to app.path().app_cache_dir().unwrap().

Generate Flatpak Node sources for Tauri

To generate Node sources for Flatpak, use the flatpak-node-generator tool with the --no-requests-cache flag. For Yarn: flatpak-node-generator --no-requests-cache -o node-sources.json yarn /path/to/your/lock/file/yarn.lock. For NPM: flatpak-node-generator --no-requests-cache -o node-sources.json npm /path/to/your/lock/file/package-lock.json.

Submitting Tauri app to Flathub workflow

To submit a Tauri app to Flathub: 1. Fork the Flathub repository at https://github.com/flathub/flathub. 2. Clone the fork with git clone --branch=new-pr git@github.com:your_github_username/flathub.git. 3. Enter the repository and create a new branch with git checkout -b your_app_name. 4. Add your app's manifest file and commit changes. 5. Push to your fork and open a pull request against the new-pr branch on GitHub. 6. Your app enters the review process; reviewers may request changes. 7. When approved, you receive an invitation to edit your app's repository for continuous updates.

Flatpak Node and Rust SDK extensions

Tauri Flatpak builds require the org.freedesktop.Sdk.Extension.node20 and org.freedesktop.Sdk.Extension.rust-stable SDK extensions, with build-options append-path set to /usr/lib/sdk/node20/bin:/usr/lib/sdk/rust-stable/bin.

Flatpak build command for Tauri with deb bundler

The Flatpak build command for Tauri is: yarn run tauri build -- -b deb

Flatpak Yarn offline mirror configuration

For offline Yarn builds in Flatpak, configure the .yarnrc file with: 'yarn-offline-mirror "/run/build/your-module/flatpak-node/yarn-mirror"' and 'yarn-offline-mirror-pruning true'.

Flatpak Cargo vendor configuration

For offline Cargo builds in Flatpak, create src-tauri/.cargo/config.toml with vendored sources pointing to /run/build/your-module/cargo/vendor.

Debian metainfo file location in Tauri bundle config

To include AppStream metainfo with a Debian bundle, add it to the tauri.conf.json bundle configuration under linux.deb.files with the key /usr/share/metainfo/org.your.id.metainfo.xml pointing to the relative path of your metainfo file.

Flatpak installation and testing prerequisites

To test a Tauri Flatpak locally, install flatpak and flatpak-builder tools. On Debian/Ubuntu: sudo apt install flatpak flatpak-builder. On Arch: sudo pacman -S --needed flatpak flatpak-builder. On Fedora: sudo dnf install flatpak flatpak-builder. On Gentoo: sudo emerge --ask sys-apps/flatpak dev-util/flatpak-builder. Then install the GNOME runtime: flatpak install flathub org.gnome.Platform//47 org.gnome.Sdk//47.

Flatpak local build and test command

To build and test a Tauri Flatpak locally, run: flatpak-builder --force-clean --user --disable-cache --repo flatpak-repo flatpak flatpak-builder.yaml. To run the app: flatpak run <your flatpak id>. To update: flatpak -y --user update <your flatpak id>.

Generate Flatpak Cargo sources for Tauri

To generate Cargo sources for Flatpak, run: python3 flatpak-builder-tools/cargo/flatpak-cargo-generator.py -o cargo-sources.json src-tauri/Cargo.lock

Closed source Tauri Flatpak distribution via pre-built deb

For closed source Tauri apps, build the .deb bundle first using Tauri's deb bundler, then reference it in the Flatpak manifest as a remote file source with sha256 checksum verification. The Flatpak build then extracts and installs the binary, libraries, desktop file, and icons from the .deb package.

Tauri Windows installers for Microsoft Store

Tauri currently generates EXE and MSI installers. For Microsoft Store distribution, you must create an application that links to the unpacked application via an offline installer, and the installer must handle auto-updates and be code signed.

Microsoft Store distribution prerequisites

To publish apps on the Microsoft Store you must have a Microsoft account and enroll as a developer either as an individual or as a company.

Generate app icons with tauri icon command

The Tauri CLI can generate all required app icons including Microsoft Store icons using the tauri icon command with a PNG or SVG source file as input.

Publisher name cannot match product name in Microsoft Store

Your application publisher name cannot match the application product name. If the publisher configuration value is not set, Tauri derives it from the second part of your bundle identifier. If they conflict, define the publisher value separately in the tauri.conf.json under bundle.publisher to resolve the conflict.

Microsoft Store silent installation requirement

The Microsoft Store requires Win32 installers to support silent installation. Tauri's NSIS -setup.exe installer installs silently with the /S flag (uppercase S). When registering the installer in Partner Center, provide /S as the silent install argument. For MSI installers, use the standard msiexec flag /quiet.

Give your agent this brain