tauri-apps/tauri · error

failed to get ayatana-appindicator library path using pkg-co

Error message

failed to get ayatana-appindicator library path using pkg-config.

What it means

When bundling Linux packages with the tray-icon feature enabled and TAURI_LINUX_AYATANA_APPINDICATOR set to true/1, the CLI asks pkg-config for the library directory of ayatana-appindicator3-0.1 to locate libayatana-appindicator3.so.1 for deb/appimage metadata. get_library_path returns None when pkg-config is missing, fails, or the .pc file is not found, and this expect panics.

Source

Thrown at crates/tauri-cli/src/interface/rust.rs:1389

  let mut appimage_files = config.linux.appimage.files;

  // set env vars used by the bundler and inject dependencies
  #[cfg(target_os = "linux")]
  {
    let mut libs: Vec<String> = Vec::new();

    if enabled_features.contains(&"tray-icon".into())
      || enabled_features.contains(&"tauri/tray-icon".into())
    {
      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());

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Install the development package and pkg-config: `sudo apt-get install -y pkg-config libayatana-appindicator3-dev` (Fedora: `sudo dnf install pkgconf-pkg-config libayatana-appindicator-gtk3-devel`).
  2. Verify detection manually: `pkg-config --libs-only-L ayatana-appindicator3-0.1` must print a -L path.
  3. If your system actually provides the older libappindicator, unset TAURI_LINUX_AYATANA_APPINDICATOR (or set it to a value other than true/1) so the CLI takes the auto-detect/libappindicator path.
  4. For custom prefixes, export PKG_CONFIG_PATH=/your/prefix/lib/pkgconfig before building.

Example fix

# before: panic 'failed to get ayatana-appindicator library path'
$ tauri build

# after: install deps in the build image
$ sudo apt-get install -y pkg-config libayatana-appindicator3-dev
$ tauri build
Defensive patterns

Strategy: validation

Validate before calling

# Precheck the exact probe tauri performs
pkg-config --libs-only-L ayatana-appindicator3-0.1 | grep -q -- '-L' || {
  echo 'install: sudo apt-get install -y pkg-config libayatana-appindicator3-dev'; exit 1;
}

Prevention

When it happens

Trigger: `tauri build` producing a deb/appimage with tray-icon or tauri/tray-icon enabled, TAURI_LINUX_AYATANA_APPINDICATOR=true (or 1), on a system without libayatana-appindicator3-dev installed, without pkg-config installed, or with a custom prefix missing from PKG_CONFIG_PATH.

Common situations: Clean CI containers (ubuntu-debootstrap style minimal images) lacking the -dev packages; build containers pinned to old images that shipped libappindicator instead of ayatana; sysroots where PKG_CONFIG_PATH does not cover /usr/lib/<triplet>/pkgconfig.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/2a290a1fb2d5c352. Report an issue: GitHub.