Skip to content

AppImage

AppImage 是一种分发格式,它不依赖系统已安装的软件包,而是打包应用所需的所有依赖和文件。因此,输出文件较大,但更容易分发,因为它在许多 Linux 发行版上受支持,并且可以在不安装的情况下运行。用户只需将文件设置为可执行 (chmod a+x MyProject.AppImage),然后就可以运行它 (./MyProject.AppImage)。

AppImages 很方便,如果你无法制作针对特定发行版包管理器的包,它可以简化分发过程。不过,你应该谨慎使用,因为文件大小会从 2-6 MB 增长到超过 70 MB。

🌐 AppImages are convenient, simplifying the distribution process if you cannot make a package targeting the distribution’s package manager. Still, you should carefully use it as the file size grows from the 2-6 MB range to 70+ MB.

🌐 Limitations

核心库如 glibc 经常会破坏与旧系统的兼容性。基于这个原因,你必须使用你打算支持的最旧的基础系统来构建你的 Tauri 应用,同时该系统还需提供 Tauri v2 所需的 WebKitGTK 4.1 包。Ubuntu 22.04 和 Debian 12 是适用的基准示例,因为它们从标准软件包库中提供 libwebkit2gtk-4.1-dev。在较新的基础系统上构建可能会提高你的应用所需的最小 glibc 版本,因此在旧系统上运行时,你可能会遇到类似 /usr/lib/libc.so.6: version 'GLIBC_2.33' not found 的运行时错误。我们建议使用 Docker 容器或 GitHub Actions 来为 Linux 构建你的 Tauri 应用。

🌐 Core libraries such as glibc frequently break compatibility with older systems. For this reason, you must build your Tauri application using the oldest base system you intend to support that also provides Tauri v2’s required WebKitGTK 4.1 packages. Ubuntu 22.04 and Debian 12 are suitable baseline examples 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 your app, so when running on an older system, you may face a runtime error like /usr/lib/libc.so.6: version 'GLIBC_2.33' not found. We recommend using a Docker container or GitHub Actions to build your Tauri application for Linux.

请参阅问题 tauri-apps/tauri#1355rust-lang/rust#57497,以及 AppImage 指南 获取更多信息。

🌐 See the issues tauri-apps/tauri#1355 and rust-lang/rust#57497, in addition to the AppImage guide for more information.

🌐 Multimedia support via GStreamer

如果你的应用播放音频/视频,你需要启用 tauri.conf.json > bundle > linux > appimage > bundleMediaFramework。这将增加 AppImage 打包包的大小,以包含媒体播放所需的额外 gstreamer 文件。此标志目前仅在 Ubuntu 构建系统上完全支持。确保你的构建系统具有应用在运行时可能需要的所有插件。

🌐 If your app plays audio/video you need to enable tauri.conf.json > bundle > linux > appimage > bundleMediaFramework. This will increase the size of the AppImage bundle to include additional gstreamer files needed for media playback. This flag is currently only fully supported on Ubuntu build systems. Make sure that your build system has all the plugins your app may need at runtime.

🌐 Custom Files

要在 AppImage 中包含你不想通过 Tauri 的 resources 功能 包含的自定义文件,你可以在 tauri.conf.json > bundle > linux > appimage > files 中提供文件或文件夹列表。配置对象将 AppImage 中的路径映射到你文件系统上文件的路径,相对于 tauri.conf.json 文件。下面是一个配置示例:

🌐 To include custom files in the AppImage that you do not want to include via Tauri’s resources feature, you can provide a list of files or folders in tauri.conf.json > bundle > linux > appimage > files. The configuration object maps the path in the AppImage to the path to the file on your filesystem, relative to the tauri.conf.json file. Here’s an example configuration:

tauri.conf.json
{
"bundle": {
"linux": {
"appimage": {
"files": {
"/usr/share/README.md": "../README.md", // copies the ../README.md file to <appimage>/usr/share/README.md
"/usr/assets": "../assets/" // copies the entire ../assets directory to <appimage>/usr/assets
}
}
}
}
}

🌐 AppImages for ARM-based devices

linuxdeploy,Tauri 使用的 AppImage 工具,目前[不支持交叉编译] ARM AppImage。这意味着 ARM AppImage 只能在 ARM 设备或模拟器上构建。

查看我们的 GitHub Action 指南,了解一个利用 QEMU 构建应用的示例工作流。请注意,这非常慢,只推荐在 Build Minutes 免费的公共仓库中使用。在私有仓库中,GitHub 的 ARM 运行器应该更具成本效益,并且更易于设置。

🌐 Check out our GitHub Action guide for an example workflow that leverages QEMU to build the app. Note that this is extremely slow and only recommended in public repositories where Build Minutes are free. In private repositories GitHub’s ARM runners should be more cost-efficient and much easier to set up.


Tauri 中文网 - 粤ICP备13048890号
Nodejs.cn 旗下网站