tauri-apps/tauri · error · anyhow::Error

no rlib files found for prefix {prefix} in {}

Error message

no rlib files found for prefix {prefix} in {}

What it means

The Tauri benchmark harness measures native library footprint via rlib_size, which scans <target_dir>/build/<library>/*/out for files named lib<library>*.rlib and sums their sizes (deduplicating by file-name stem). If the accumulated size stays zero, the directory structure was readable but no rlib matched the prefix, and the run aborts with this error naming the prefix and build directory it searched.

Source

Thrown at bench/src/run_benchmark.rs:174

        out_path.display()
      )
    })? {
      let file = file.context("failed to read build output directory entry")?;
      let name = file.file_name().to_string_lossy().to_string();
      if name.starts_with(&prefix) && name.ends_with(".rlib") {
        let start = name.split('-').next().unwrap();
        if seen.insert(start.to_string()) {
          size += file
            .metadata()
            .context("failed to read file metadata")?
            .len();
        }
      }
    }
  }

  if size == 0 {
    anyhow::bail!(
      "no rlib files found for prefix {prefix} in {}",
      build_dir.display()
    );
  }

  Ok(size)
}

fn get_binary_sizes(target_dir: &Path, target: &str) -> Result<HashMap<String, u64>> {
  let mut sizes = HashMap::<String, u64>::new();

  let wry_size = rlib_size(target_dir, "wry")?;
  sizes.insert("wry_rlib".to_string(), wry_size);

  for (name, example_exe) in get_all_benchmarks(target) {
    let exe_path = utils::bench_root_path().join(&example_exe);
    let meta = std::fs::metadata(&exe_path)
      .with_context(|| format!("failed to read metadata for {}", exe_path.display()))?;

View on GitHub (pinned to 2f1cd75b0f)

Solutions

  1. Build the workspace first so build-script output rlibs exist: cargo build --release (or cargo bench --no-run) before running run_benchmark
  2. Verify the library name passed to the size step - it must match the crate name (files must start with lib<name>, e.g. libwry)
  3. Confirm the target_dir argument points at the cargo target directory that actually contains build/<library>/ (watch CARGO_TARGET_DIR and --target triples)
  4. If artifacts were partially cleaned, cargo clean once and rebuild fully

Example fix

# before
cargo run --release --bin run_benchmark -- sizes  # -> no rlib files found for prefix libwry

# after
cargo build --release
cargo run --release --bin run_benchmark -- sizes
Defensive patterns

Strategy: validation

Validate before calling

# run before the size benchmark
test -n "$(find target/release/build/wry -name 'libwry*.rlib' 2>/dev/null)" \
  || cargo build --release

Try / catch

match rlib_size(&target_dir, "wry") {
  Err(e) if e.to_string().contains("no rlib files") => {
    // run `cargo build --release` and retry once; otherwise report
    Err(e)
  }
  other => other,
}

Prevention

When it happens

Trigger: Running the binary-sizes benchmark (run_benchmark with the sizes benchmark) for a library such as wry, tao or tauri when target/<triple>/build/<library>/*/out contains no file starting with lib<library> and ending in .rlib - because the library was never compiled into that target dir, artifacts were cleaned, or the passed target_dir/library name is wrong.

Common situations: Fresh clone where the bench binary was run without building the measured crates; `cargo clean` between build and measurement; passing a --target-dir or CARGO_TARGET_DIR that differs from where the rlibs landed; misspelled library name argument.

Related errors


AI-assisted analysis of tauri-apps/tauri@2f1cd75b0f (2026-08-16). Data as JSON: /api/errors/26897d9b5f6d6c0a. Report an issue: GitHub.