Did you come from Cross-Compiling Tauri Applications for ARM-based Devices?
Have you found yourself successfully cross-compiling a Tauri App for another system/architecture (aarch64-linux-gnu / raspberry pi in my case), just to find out that it won't launch because it is linked against a newer glibc version? I was in that situation as well.
In this repo, we are using zig(zig cc), to link our app against an older glibc version.
This repo uses bun, but you can use any javascript runtime/package manager as you like.
Tauri V1, do all the steps.
- sudo apt install libwebkit2gtk-4.0-dev:arm64
+ sudo apt install libwebkit2gtk-4.1-dev:arm64
Install Zig, and add it to your PATH.
Set your desired glibc version at .cargo/config.toml
at the root of this repo. List available glibc versions with zig targets
and look for the glibc array. If you want to target 2.30
for example, you can change the example as shown.
rustflags = [
- "-Clink-arg=-target aarch64-linux-gnu.2.35",
+ "-Clink-arg=-target aarch64-linux-gnu.2.30",
]
source cc.sh
What does this do? It is setting environment variables for pkg-config, as mentioned on the website. (change PKG_CONFIG_PATH accordingly, depending on your target. as for the PKG_CONFIG_SYSROOT_DIR, I've set it to / instead of the one mentioned in the tutorial as it was prepending it to the library search paths.) This also adds the zig cc wrapper to path, so that config.toml can find it. (This is a workaround, as I couldn't get it to find the wrapper with relative paths.)
sudo apt install pkg-config
After all that, it should just compile, and the output should be linked against an older glibc version successfully. (Change to your target arch)
cargo tauri build --target aarch64-unknown-linux-gnu