tauri-apps/tauri · error
failed to get libappindicator-gtk library path using pkg-con
Error message
failed to get libappindicator-gtk library path using pkg-config.
What it means
With tray-icon enabled and TAURI_LINUX_AYATANA_APPINDICATOR set to any value other than true/1, the CLI is forced onto the libappindicator branch and asks pkg-config for appindicator3-0.1 to locate libappindicator3.so.1. If that .pc file cannot be found (package not installed, no pkg-config), get_library_path returns None and this expect panics. Note the env var is a strict opt-out of ayatana: values like 'false', '0', or typos all select this branch.
Source
Thrown at crates/tauri-cli/src/interface/rust.rs:1398
{
let (tray_kind, path) = std::env::var_os("TAURI_LINUX_AYATANA_APPINDICATOR")
.map(|ayatana| {
if ayatana == "true" || ayatana == "1" {
(
pkgconfig_utils::TrayKind::Ayatana,
format!(
"{}/libayatana-appindicator3.so.1",
pkgconfig_utils::get_library_path("ayatana-appindicator3-0.1")
.expect("failed to get ayatana-appindicator library path using pkg-config.")
),
)
} else {
(
pkgconfig_utils::TrayKind::Libappindicator,
format!(
"{}/libappindicator3.so.1",
pkgconfig_utils::get_library_path("appindicator3-0.1")
.expect("failed to get libappindicator-gtk library path using pkg-config.")
),
)
}
})
.unwrap_or_else(pkgconfig_utils::get_appindicator_library_path);
match tray_kind {
pkgconfig_utils::TrayKind::Ayatana => {
depends_deb.push("libayatana-appindicator3-1".into());
libs.push("libayatana-appindicator3.so.1".into());
}
pkgconfig_utils::TrayKind::Libappindicator => {
depends_deb.push("libappindicator3-1".into());
libs.push("libappindicator3.so.1".into());
}
}
// conditionally setting it in case the user provided its own version for some reason
let path = PathBuf::from(path);View on GitHub (pinned to 52e4b6e71d)
Solutions
- Prefer ayatana on modern distros: set TAURI_LINUX_AYATANA_APPINDICATOR=1 (or unset it, letting the CLI auto-detect ayatana first).
- If you truly need libappindicator (legacy targets), install its dev package: `sudo apt-get install -y pkg-config libappindicator3-dev`.
- Verify with `pkg-config --libs-only-L appindicator3-0.1`.
- Audit your CI/Docker env for stale TAURI_LINUX_AYATANA_APPINDICATOR values.
Example fix
# before: forces removed legacy lib -> panic env: TAURI_LINUX_AYATANA_APPINDICATOR: 'false' # after env: TAURI_LINUX_AYATANA_APPINDICATOR: '1'
Defensive patterns
Strategy: validation
Validate before calling
# Decide tray backend explicitly and verify before building
if [ "${TAURI_LINUX_AYATANA_APPINDICATOR:-}" != "true" ] && [ "${TAURI_LINUX_AYATANA_APPINDICATOR:-}" != "1" ]; then
pkg-config --libs-only-L appindicator3-0.1 | grep -q -- '-L' || {
echo 'set TAURI_LINUX_AYATANA_APPINDICATOR=1 or install libappindicator3-dev'; exit 1;
}
fi Prevention
- On Ubuntu 22.04+/Debian 12+ always set TAURI_LINUX_AYATANA_APPINDICATOR=1 or unset it — legacy libappindicator is gone.
- Audit CI/Docker env for stale tray backend variables when upgrading base images.
- Prefer relying on the CLI's auto-detection (no env var) unless you have a hard requirement.
When it happens
Trigger: `tauri build` for deb/appimage with the tray feature while TAURI_LINUX_AYATANA_APPINDICATOR is exported as e.g. 'false' or '0' on a system without libappindicator-gtk3-dev (most modern distros removed libappindicator in favor of ayatana).
Common situations: Copied CI env vars from old projects forcing libappindicator on Ubuntu 22.04+/Debian 12 where appindicator3-0.1 no longer exists; Docker build images upgraded without updating the env matrix.
Related errors
- failed to get ayatana-appindicator library path using pkg-co
- Can't detect any appindicator library
- couldn't find a square icon to use as AppImage icon
- Can't read source directory
- Unexpected target triple {}
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/4678293957efb345.
Report an issue: GitHub.